php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37770 'For' cycle bad work
Submitted: 2006-06-09 18:51 UTC Modified: 2006-06-09 19:36 UTC
From: sorrentino at ingv dot it Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.4.2 OS: Linux Slackware
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sorrentino at ingv dot it
New email:
PHP Version: OS:

 

 [2006-06-09 18:51 UTC] sorrentino at ingv dot it
Description:
------------
cyclyng (with for and while) from 'A' to 'Z' the cycle doesn't stop to 'Z' but continue, passing from 'AA', 'till 'YZ'

ps.
the bug was submitted here too
<http://bugs.php.net/bug.php?id=15597> 
on date: 18 Feb 2002
php version: 4.1.1
and is still present in php4.4.2 and in php5.2-200606091630

Reproduce code:
---------------
<?
for($i='A'; $i<='Z'; $i++)
        echo $i . ", ";
?>

Expected result:
----------------
A, B, C, ..., Z

Actual result:
--------------
A, B, C, ..., Z, AA, AB, AC, ..., YW, YX, YY, YZ

i can't post a backtrace because the program exit normally, without a crash :-(

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-09 19:36 UTC] judas dot iscariote at gmail dot com
altough this is not a bug, because this is the expected, correct behaviuor, the documentation do not mention this feature, and can be confusing for newbies.

I suggest you reclassify this as a documentation problem.and read this comment http://cl2.php.net/manual/en/control-structures.for.php#42850 to get the result you expect, also make sure to ask in a support forum next time.
 [2006-06-09 19:36 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 09 14:01:33 2025 UTC