ID: 42949
User updated by: phpbug at fint dot org
Reported By: phpbug at fint dot org
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Linux
PHP Version: 5.2.4
New Comment:
Apparently it also has non-alpha characters in it, which is why I was
confused.
<?php
foreach (range('A', 'z') as $letter) {
echo $letter;
}
?>
Yields:
ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz
Previous Comments:
------------------------------------------------------------------------
[2007-10-12 16:17:41] felipensp at gmail dot com
The order is A-Z, a-z.
<?php
$init = ord('A');
$end = ord('z');
printf("Init.: %d | End.: %d\n", $init, $end);
for ($i = $init; $i <= $end; $i++) {
print chr($i);
}
print "\n";
?>
------------------------------------------------------------------------
[2007-10-12 13:49:56] phpbug at fint dot org
Description:
------------
range('a', 'Z') gives random junk
Reproduce code:
---------------
<?php
foreach (range('a', 'Z') as $letter) {
echo $letter;
}
?>
Expected result:
----------------
a-z and A-Z (wishful thinking?)
I am trying to recreate Perl's "@a=('a'..'z', 'A'..'Z');"
Actual result:
--------------
a`_^]\[Z
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42949&edit=1