开发者

PHP explode without limit

The explode function below has a positive 开发者_开发百科limit parameter of 2. What does this parameter do, and how can I remove it?

$array = explode(' ', $str, 2);


In your case the array will have three elements , depending upon the value of $str , first two elements would be strings separated by space . The remaining part of the string will be the thrid element.

If $str is very long and all you need is first two elements of array then there is no point of removing 2 , latter if you like can do $array2 = explode(' ',$array[2]);


The last parameter is optional.

$array = explode(' ', $str);

Try this for splitting the $str with space (' '). No limit on items.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜