php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #2965 The <= operator does not work properly on characters.
Submitted: 1999-12-13 10:09 UTC Modified: 2002-11-30 10:22 UTC
Votes:2
Avg. Score:2.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: fred at webblake dot com Assigned: hholzgra (profile)
Status: Closed Package: Documentation problem
PHP Version: 4 OS: Redhat Linux 6.0
Private report: No CVE-ID: None
 [1999-12-13 10:09 UTC] fred at webblake dot com
for($i = 'A'; $i <= 'Z' ; $i++)
   echo "$i<br>\n";

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-30 16:49 UTC] hholzgra@php.net
it may look strange but it is intended behaviour
 [2002-09-30 19:48 UTC] hholzgra@php.net
changed to documentation problem and reopened until verified
 [2002-11-30 10:22 UTC] pollita@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

PHP follows Perl convention when performing arithmetic operations on character values.  Explanation added in PHP-DOCs
 [2002-11-30 20:36 UTC] pcgod at gmx dot net
even if this is the intended behaviour there is one problem left:
the loop stops at YZ and therefore you should assume that 'YZ' == 'Z' but echo ('YZ' == 'Z'?1:0); returns 0
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Aug 17 07:01:28 2024 UTC