ID:               30732
 Updated by:       [EMAIL PROTECTED]
 Reported By:      thomas dot keller at inatec dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Linux Mandrake 8, Linux 2.4.3
 PHP Version:      4.3.9
 New Comment:

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

When you use ++ on strings, the sequence of values is:

... 'X', 'Y', 'Z', 'AA', 'AB', ... 'AZ', 'BA', ...

Only when this sequence reaches 'ZA' does it fail the <='Z' test.


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

[2004-11-09 11:07:12] thomas dot keller at inatec dot com

Description:
------------
Configure command:
'./configure' '--prefix=/usr/local/php'
'--with-apxs2=/home/apache2/apache-2.0.52/bin/apxs'
'--enable-versioning' '--with-mysql=/usr/local/mysql' '--with-gd'
'--with-zlib'

I use the following code snippet to print out an array
of chars in alphabetic order. If I have the condition
$i < 'Z' (so only until 'Y'), everything works fine, 
for the condition(s) $i <= 'Z' or $i < ('A' + 26)
PHP produces wrong results.

I could reproduce the error on a Redhat 9 system with PHP 4.3.4.

Reproduce code:
---------------
$letters = array();

for ($i='A'; $i<='Z'; $i++) print $i;



Expected result:
----------------
ABCDEFGHIJKLMNOPQRSTUVWXYZ

(26 ^ 1 letters)

Actual result:
--------------
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABAC .. YZ

(26 ^ 2 letters)



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


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

Reply via email to