PHP去除所有空格

By | 2022-01-16

PHP去除所有空格

function trimall($str)
{
    $qian=array(" "," ","\t","\n","\r");
    $hou=array("","","","","");
    return str_replace($qian,$hou,$str); 
}
echo trimall("a b c");