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 remove trailing whitespace from a string?What is the difference between print and echo?
How do I check if a string contains HTML?
How do I make the first letter of a string uppercase?
How do I remove space from the start of a PHP string?
