php中preg_split()函数的PREG_SPLIT_NO_EMPTY到底有什么作用啊?
PREG_SPLIT_NO_EMPTY——返回分隔后的非空部分。到底是什么意思啊?我写了以下代码,两者没有区别:$keywords=preg_split("/[\s,]+...
PREG_SPLIT_NO_EMPTY——返回分隔后的非空部分。到底是什么意思啊?
我写了以下代码,两者没有区别:
$keywords = preg_split("/[\s,]+/","hypertext language ,programming",2);
foreach( $keywords as $key => $value )
{
echo "$key:$value<br/>";
}
echo "<br />";
$keywords = preg_split("/[\s,]+/","hypertext language ,programming ",2,PREG_SPLIT_NO_EMPTY);
foreach( $keywords as $key => $value )
{
echo "$key:$value<br/>";
}
echo "<br />"; 展开
我写了以下代码,两者没有区别:
$keywords = preg_split("/[\s,]+/","hypertext language ,programming",2);
foreach( $keywords as $key => $value )
{
echo "$key:$value<br/>";
}
echo "<br />";
$keywords = preg_split("/[\s,]+/","hypertext language ,programming ",2,PREG_SPLIT_NO_EMPTY);
foreach( $keywords as $key => $value )
{
echo "$key:$value<br/>";
}
echo "<br />"; 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询