note 45982 modified in function.preg-split by danbrown
| From: | danbrown@php.net | Date: | Wed, 27 May 2009 13:50:57 +0000 |
| Subject: | note 45982 modified in function.preg-split by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156071@lists.php.net to get a copy of this message | ||
To clarify the "limit" parameter and the PREG_SPLIT_DELIM_CAPTURE option,
<?php
$preg_split('(/ /)', '1 2 3 4 5 6 7 8', 4 ,PREG_SPLIT_DELIM_CAPTURE );
?>
returns:
('1', ' ', '2', ' ' , '3', ' ', '4
5 6 7 8')
So you actually get 7 array items not 4
--was--
To clarify the "limit" parameter and the PREG_SPLIT_DELIM_CAPTURE option,
$preg_split('(/ /)', '1 2 3 4 5 6 7 8', 4 ,PREG_SPLIT_DELIM_CAPTURE );
returns
('1', ' ', '2', ' ' , '3', ' ', '4
5 6 7 8')
So you actually get 7 array items not 4
http://php.net/manual/en/function.preg-split.php