note 97476 added to function.explode
| From: | drieick at hotmail dot com | Date: | Thu, 22 Apr 2010 03:34:34 +0000 |
| Subject: | note 97476 added to function.explode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168490@lists.php.net to get a copy of this message | ||
When explode is given an empty $string, it'll return an array with a single empty element.
<?php
# returns Array([0] => );
print_r(explode(',', ''));
?>
This is not a bug, but it can be pretty tricky (especially with callbacks that expect a certain type
of array). So, be sure to check your arrays. It's not a bug, because there's nothing to
split.
----
Server IP: 64.71.164.2
Probable Submitter: 71.22.33.6
----
Manual Page -- http://www.php.net/manual/en/function.explode.php
Edit -- https://master.php.net/note/edit/97476
Del: integrated -- https://master.php.net/note/delete/97476/integrated
Del: useless -- https://master.php.net/note/delete/97476/useless
Del: bad code -- https://master.php.net/note/delete/97476/bad+code
Del: spam -- https://master.php.net/note/delete/97476/spam
Del: non-english -- https://master.php.net/note/delete/97476/non-english
Del: in docs -- https://master.php.net/note/delete/97476/in+docs
Del: other reasons-- https://master.php.net/note/delete/97476
Reject -- https://master.php.net/note/reject/97476
Search -- https://master.php.net/manage/user-notes.php