Home >Backend Development >PHP Tutorial >php正则有办法去除第一段空格吗?

php正则有办法去除第一段空格吗?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:51:42870browse

php正则有办法去掉第一段空格吗??

$str="123            脚本之家 www.jb51.ne      ";
 

最后我需要的是

$str="123脚本之家 www.jb51.ne      ";
 

有什么办法吗
------解决方案--------------------
$str="123            脚本之家 www.jb51.ne      ";
$p = preg_split ("/\s{2,}/",$str);
var_dump(join($p));

------解决方案--------------------
$str="123            脚本之家 www.jb51.ne      ";
var_dump(preg_replace('/\s+/', '', $str, 1));

string(29) "123脚本之家 www.jb51.ne      "

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