Possible Duplicate:
How to strip all spaces out of a string in php?
How can I remove all spaces from a string in PHP and in Javascript? I want to remove all spaces from the left hand side, right hand side and from between each character.
For Example:
$myString = " Hello my Dear ";
I want to get this string as "HellomyDear".
Please demonstrate how I can do this in both PHP and Javascript.