note 9447 added to strlen

From: Date: Fri, 03 Nov 2000 16:37:33 +0000
Subject: note 9447 added to strlen
Groups: php.notes 
Request: Send a blank email to php-notes+get-7345@lists.php.net to get a copy of this message
This bit of code works just fine in PHP: $tmp=0; $s="blah"; while($c=$s[$tmp++]) { echo $c; } Depending on your warning level you may get a warning when $tmp = 4 because you have gone beyond the end of the string. If you don't care about this warning either change your warning level or simply swallow it using: $tmp=0; $s="blah"; while(@$c=$s[$tmp++]) { echo $c; } The @ in front of the assignment will swallow any warnings from that assignment. http://www.php.net/manual/function.strlen.php

« previous php.notes (#7345) next »