Home >Web Front-end >JS Tutorial >php remove all spaces in string

php remove all spaces in string

PHP中文网
PHP中文网Original
2016-05-16 19:20:281826browse

php deletes all spaces in the string
is actually an extension of the trim function
trim can only delete spaces on both sides of the string

function trimall($str)//删除空格
{
    $qian=array(" "," ","\t","\n","\r");$hou=array("","","","","");
    return str_replace($qian,$hou,$str);    
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn