note 109343 modified in function.explode by danbrown
| From: | danbrown@php.net | Date: | Mon, 16 Jul 2012 15:42:26 +0000 |
| Subject: | note 109343 modified in function.explode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189209@lists.php.net to get a copy of this message | ||
there is a difference how active server pages (vbs/asp) handle array. an empty string will return
nothing after split. while translating asp to php ... take
this: <?php $a =
explode("\\r\\n",
""); print(count($a)); $b =
ms_explode("\\r\\n",
""); print(count($b)); function
ms_explode($delimiter, $string, $limit = 0xFFFFFFFF) {
return($string ? explode($delimiter, $string, $limit) : array());
} ?>
--was--
there is a difference how active server pages (vbs/asp) handle array. an empty string will return
nothing after split. while translating asp to php ... take this:
$a = explode("\r\n", "");
print(count($a));
$b = ms_explode("\r\n", "");
print(count($b));
function ms_explode($delimiter, $string, $limit = 0xFFFFFFFF)
{
return($string ? explode($delimiter, $string, $limit) : array());
}
http://php.net/manual/en/function.explode.php