note 32016 deleted from function.strlen by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 12:11:16 +0000 |
| Subject: | note 32016 deleted from function.strlen by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189607@lists.php.net to get a copy of this message | ||
Note Submitter: suchy at ecl dot pl
----
a little modification of rasmus solution
<?php
$tmp=0; $s="blah";
while($c=$s[$tmp++]) { echo $c; }
?>
but what happens when the string contains zeros?
<?php $s="blah0blah"; ?>
the script stops....
here is sample of code and the string is correcly parsed using strlen() even when containing zeros:
<?php
$s="blah0blah";
$si=0;
$s_len=strlen($s);
for ($si=0;$si<$s_len;$si++)
{
$c=$s[$si];
echo $c;
}
?>