note 45963 deleted from function.preg-split by tularis
| From: | tularis@php.net | Date: | Thu, 03 May 2007 22:28:17 +0000 |
| Subject: | note 45963 deleted from function.preg-split by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126183@lists.php.net to get a copy of this message | ||
Note Submitter: tuxedobob
----
The documentation for the "limit" parameter may be slightly confusing. "limit"
does indeed work like the limit of explode, in that the "limit"th substring will contain
the rest of the string passed, _not_ that it will split it fully and return only the first
"limit"th strings. Therefore:
$preg_split('/ /', '1 2 3 4 5 6 7 8 9', 4);
returns
('1', '2', '3', '4 5 6 7 8 9')
and _not_
('1', '2', '3', '4').
Although explode has an example of this, there is none here.