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

php remove all spaces in string

PHP中文网
Release: 2016-05-16 19:20:28
Original
1824 people have browsed it

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);    
}
Copy after login
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template