note 49803 added to function.str-split
| From: | robatthedomainoftorenwaredtcom at osu1 dot php dot net | Date: | Wed, 09 Feb 2005 04:15:37 +0000 |
| Subject: | note 49803 added to function.str-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84699@lists.php.net to get a copy of this message | ||
There is a subtle bug in Gregor Mosheh's function. If the last character of the string tested
is a "0", it will evaluate to false, and you will be missing a character off the end of
your string.
Ouch.
You should change
while($string)
to
while(strlen($str)).
----
Manual Page -- http://www.php.net/manual/en/function.str-split.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49803
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49803&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49803&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49803&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49803&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49803&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49803&report=yes
Search -- http://master.php.net/manage/user-notes.php