note 116804 added to function.str-split

From: Date: Mon, 02 Mar 2015 20:38:51 +0000
Subject: note 116804 added to function.str-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-201841@lists.php.net to get a copy of this message
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. ---- Server IP: 72.52.91.14 Probable Submitter: 82.3.127.21 ---- Manual Page -- http://php.net/manual/en/function.str-split.php Edit -- https://master.php.net/note/edit/116804 Del: integrated -- https://master.php.net/note/delete/116804/integrated Del: useless -- https://master.php.net/note/delete/116804/useless Del: bad code -- https://master.php.net/note/delete/116804/bad+code Del: spam -- https://master.php.net/note/delete/116804/spam Del: non-english -- https://master.php.net/note/delete/116804/non-english Del: in docs -- https://master.php.net/note/delete/116804/in+docs Del: other reasons-- https://master.php.net/note/delete/116804 Reject -- https://master.php.net/note/reject/116804 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#201841) next »