note 76686 deleted from function.explode by tularis
| From: | tularis@php.net | Date: | Mon, 27 Oct 2008 13:05:21 +0000 |
| Subject: | note 76686 deleted from function.explode by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-145817@lists.php.net to get a copy of this message | ||
Note Submitter: thomas at tgohome dot com
----
This had me for a moment. A quick gotcha, for me, because it was causing some problems in a script
of mine.
If you explode an empty string, you'll get an array with one element - an empty string, and not
an empty array or string as you may think.
For example:
<?php
$string = "";
$numbers = explode(",", $string); // Array with one element, "".
$string = "1,2,3";
$numbers = explode(",", $string); // Array with three elements
?>