note 24525 added to function.split
| From: | joel at elserver dot com | Date: | Tue, 20 Aug 2002 14:04:45 +0000 |
| Subject: | note 24525 added to function.split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-35253@lists.php.net to get a copy of this message | ||
it seems that split() does not split a null-separated string. neither does preg_split(), but
explode() does.
Eg.
<?
$str = "a\0b\0c";
print "Using split";
print_r(split("\0",$str));
print "<hr>Using preg_split";
print_r(preg_split("/\0/",$str));
print "<hr>Using explode";
print_r(explode("\0",$str));
?>
will produce the desired array (a,b,c) only with explode.
Is this a bug or am I missing a doc. somewhere?
--
http://www.php.net/manual/en/function.split.php
http://master.php.net/manage/user-notes.php?action=edit+24525
http://master.php.net/manage/user-notes.php?action=delete+24525
http://master.php.net/manage/user-notes.php?action=reject+24525