|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-05-13 20:18 UTC] 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 00:00:01 2025 UTC |
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})); ?>