Edit report at https://bugs.php.net/bug.php?id=67754&edit=1
ID: 67754
Updated by: [email protected]
Reported by: yppah56 at yahoo dot com dot tw
Summary: "for" judge A-Z error.
Status: Open
Type: Bug
Package: PHP Language Specification
Operating System: Linux(Ubuntu13.4)
PHP Version: 5.4.31
Block user comment: N
Private report: N
New Comment:
This happens because after 'Z' comes 'AA', and 'AA' is smaller than 'Z'.
The correct condition in this case is:
$char != 'AA'
The other way (recommended):
foreach (range('A', 'Z') as $char) {
}
Previous Comments:
------------------------------------------------------------------------
[2014-08-04 07:36:25] yppah56 at yahoo dot com dot tw
Description:
------------
0000
When for() judge 'Z', find error.
for ($char='A'; $char<='Z'; $char++) echo $char;
Echo not as expected.
Maybe counting error.
Test script:
---------------
// this program is OK
for ($char='A'; $char<='Y'; $char++) {
echo $char;
}
// this program is Error
for ($char='A'; $char<='Z'; $char++) {
echo $char;
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67754&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.