note 29488 added to function.strstr
| From: | php at silisoftware dot com | Date: | Fri, 14 Feb 2003 21:37:02 +0000 |
| Subject: | note 29488 added to function.strstr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43957@lists.php.net to get a copy of this message | ||
PHP versions before 4.3.0 (tested on 4.2.2 and 4.2.3) return the $haystack from $needle only up to
the first null character. So for example:
$string = strstr("one#two\x00three", "#");
// PHP 4.2.x: $string contains "#two"
// PHP 4.3.0: $string contains "#two\x00three"
If you're trying to match nulls, you will probably get back an empty string:
$string = strstr("one#two\x00three", "\x00");
// PHP 4.2.x: $string contains ""
// PHP 4.3.0: $string contains "\x00three"
--
http://www.php.net/manual/en/function.strstr.php
http://master.php.net/manage/user-notes.php?action=edit+29488
http://master.php.net/manage/user-notes.php?action=delete+29488
http://master.php.net/manage/user-notes.php?action=reject+29488