note 73562 deleted from function.explode by tularis
| From: | tularis@php.net | Date: | Mon, 27 Oct 2008 13:06:58 +0000 |
| Subject: | note 73562 deleted from function.explode by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-145826@lists.php.net to get a copy of this message | ||
Note Submitter: jason dot minett at custoREMOVEmscripts dot co dot uk
----
A quick gotcha that had me head scratching for a while....
If the delimiter occurs right at the end of the string there will be an extra array element (an
empty string):
<?php
$str = "aaa^elephant^chocolate^albatross^";
$arr = explode ("^", $str);
echo ("Array length: ".count($arr));
?>
---------------------------------
Array length: 5