note 32016 added to function.strlen
| From: | suchy at rack1 dot php dot net | Date: | Tue, 13 May 2003 08:22:51 +0000 |
| Subject: | note 32016 added to function.strlen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-47910@lists.php.net to get a copy of this message | ||
a little modification of rasmus solution
$tmp=0; $s="blah";
while($c=$s[$tmp++]) { echo $c; }
but what happens when the string contains zeros?
$s="blah0blah";
the script stops....
here is sample of code and the string is correcly parsed using strlen() even when containing zeros:
<?
$s="blah0blah";
$si=0;
$s_len=strlen($s);
for ($si=0;$si<$s_len;$si++)
{
$c=$s[$si];
echo $c;
}
?>
--
http://www.php.net/manual/en/function.strlen.php
http://master.php.net/manage/user-notes.php?action=edit+32016
http://master.php.net/manage/user-notes.php?action=delete+32016
http://master.php.net/manage/user-notes.php?action=reject+32016