Remove whitespace in a string using php
scripts for removing spaces
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<?php $mystrng=" hello vasanthan"; // this will remove all space inside the string $trimmedstring = str_replace(' ','',$mystrng); // ouput will be like-- hellovasanthan $trimmedstring = trim($mystrng); //this output will remove the white space from starting and ending ?> |