How can I remove spaces from around a string value?
<?php
$toomuchspace = " how are you ";
echo "<$toomuchspace>\n";
$thatsbetter = trim($toomuchspace);
echo "<$thatsbetter>";
?>
And this is the result:
< how are you >
Comments on this Question/Answer
How can I remove spaces from between a string value? for example : "what's going on, my name is vishwas"; like show : "what's going on, my name is vishwas";By: vishwas, 15 Jan 2009 22:23:12
Reply to comments / post your own comment >>>
ASK A QUESTION
More strings PHP Questions
How do I escape a string with slashes?How do you check if a variable is set or not in PHP?
How do I make the first letter of each word upper case?
How do I replace a word in a string in PHP?
How can I repeat a string several times?
