Edit report at https://bugs.php.net/bug.php?id=60574&edit=1
ID: 60574
User updated by: login dot naitsirch at arcor dot de
Reported by: login dot naitsirch at arcor dot de
Summary: range() returns array of integers when arguments are
numeric strings
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: Windows 7
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
This is not clear enough, in my opinion.
Another question: Why should numeric strings be seen as integers and not as
strings?
Previous Comments:
------------------------------------------------------------------------
[2011-12-29 01:16:14] hanskrentel at yahoo dot de
This is already documented:
4.1.0 to 4.3.2 In PHP versions 4.1.0 through 4.3.2, range() sees numeric
strings
as strings and not integers. Instead, they will be used for character
sequences.
For example, "4242" is treated as "4".
------------------------------------------------------------------------
[2011-12-20 11:39:15] login dot naitsirch at arcor dot de
Description:
------------
Hi.
I think the 'range()' function should return an array with strings, if the
'start' and 'limit' arguments are numeric strings. Otherwise it should be
mentioned in the documentation.
Test script:
---------------
<?php
var_dump(range('0', '9'));
Expected result:
----------------
array(10) {
[0]=> string(1) "0"
[1]=> string(1) "1"
[2]=> string(1) "2"
[3]=> string(1) "3"
[4]=> string(1) "4"
[5]=> string(1) "5"
[6]=> string(1) "6"
[7]=> string(1) "7"
[8]=> string(1) "8"
[9]=> string(1) "9"
}
Actual result:
--------------
array(10) {
[0]=> int(0)
[1]=> int(1)
[2]=> int(2)
[3]=> int(3)
[4]=> int(4)
[5]=> int(5)
[6]=> int(6)
[7]=> int(7)
[8]=> int(8)
[9]=> int(9)
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60574&edit=1