ID:               25829
 Updated by:       [EMAIL PROTECTED]
 Reported By:      tim at timcrider dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Red Hat 9.0
 PHP Version:      5CVS-2003-10-10 (dev)
 New Comment:

It's a feature, not a bug. See
<http://www.php.net/language.operators.increment>.


Previous Comments:
------------------------------------------------------------------------

[2003-10-10 16:55:37] tim at timcrider dot com

Description:
------------
When trying to loop 'a' through 'z' using 
for ($i = 'a'; $i < 'z'; $i++)
 print $i;

it loops a-y as it should, but when you try

for ($i = 'a'; $i <= 'z'; $i++)
  print $i;

instead of going a-z it goes a-yz doubling up the letters after a-z

a-z
aa-az
ba-bz
ca-cz
... etc

 I know this breaks under php5, and under php4.

Reproduce code:
---------------
 for ($i = 'a'; $i < 'z'; ++$i)  
 {
   print "$i\n";
 }

and

 for ($i = 'a'; $i <= 'z'; ++$i)  
 {
   print "$i\n";
 }

Expected result:
----------------
abcdefghijklmnopqrstuvwxyz

(seperated by new lines)

Actual result:
--------------
abcdefghijklmnopqrstuvwxyzaaabacadaeaf....yxyyyz


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=25829&edit=1

Reply via email to