#28388 [Com]: different output for simple loop in 5.* vs 4.3.*

From: Date: Fri, 14 May 2004 20:35:35 +0000
Subject: #28388 [Com]: different output for simple loop in 5.* vs 4.3.*
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-59648@lists.php.net to get a copy of this message
ID: 28388 Comment by: solace at ezmail dot ru Reported By: fire at firepages dot org Status: Open Bug Type: Unknown/Other Function Operating System: win32 XP PHP Version: 5.0.0RC2 New Comment: Seems that there is one more 'hidden' char at the end of strings when accessing by index (probably \0 ?). This must show false, but it's true: <? $word = 'a'; var_dump(empty($word{1})); ?> Previous Comments: ------------------------------------------------------------------------ [2004-05-13 20:18:59] fire at firepages dot org Description: ------------ dunno how to describe , simply put the code below on 4.3.4 / 4.3.5 gives (my) expected answer of '12' on 5.0.0.b4 && RC2 the answer is '13' unsure which is the correct behaviour ;) Reproduce code: --------------- <? $word = 'Encyclopedia'; $x = 0; while (!empty($word[$x])){ $x++; } echo "The word <b>$word</b> has $x characters in it."; ?> Expected result: ---------------- The word Encyclopedia has 12 characters in it. Actual result: -------------- The word Encyclopedia has 13 characters in it. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28388&edit=1

« previous php.bugs (#59648) next »