note 116804 deleted from function.str-split by crell
| From: | crell@php.net | Date: | Wed, 29 Jun 2022 18:31:27 +0000 |
| Subject: | note 116804 deleted from function.str-split by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218690@lists.php.net to get a copy of this message | ||
Note Submitter: Daniel Rhodes
----
It's mentioned in the Return Values section above ("If the split_length length exceeds the
length of string, the entire string is returned as the first (and only) array element"), but
note that an input of empty string will return array(1) { [0]=> string(0) "" }.
Interestingly an input of NULL will also return array(1) { [0]=> string(0) "" }.
Compare this with, say, <?php preg_split('//', $inputString, -1, PREG_SPLIT_NO_EMPTY);
?> which will return array(0) { } for an input of empty string or NULL. I find this to be a bit
more intuitive.
Hope this helps.