//Remove whitespace from both sides of a string in php
function removeSideSpace($str)
{
return trim($str);
}
$yourString=" This is test for the string ";
echo " <br> Before remove the space == ".strlen($yourString);
$yourString= removeSideSpace($yourstring);
echo " <br> After remove the space == ".strlen($yourString);
?>
function removeSideSpace($str)
{
return trim($str);
}
$yourString=" This is test for the string ";
echo " <br> Before remove the space == ".strlen($yourString);
$yourString= removeSideSpace($yourstring);
echo " <br> After remove the space == ".strlen($yourString);
?>
No comments:
Post a Comment