#40882 [Opn->Bgs]: Ãrray_fill doesn't support negative start index
| From: | tony2001@php.net | Date: | Thu, 22 Mar 2007 10:25:28 +0000 |
| Subject: | #40882 [Opn->Bgs]: Ãrray_fill doesn't support negative start index | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-110669@lists.php.net to get a copy of this message | ||
ID: 40882
Updated by: tony2001@php.net
Reported By: guile_spam at laposte dot net
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Linux ~~~~ 2.6.12-12mdk #1 F
PHP Version: 5.2.1
New Comment:
>I guess could have the answer in the bug 24159...
Right, so this is expected.
Previous Comments:
------------------------------------------------------------------------
[2007-03-21 16:00:30] guile_spam at laposte dot net
Description:
------------
the function "array_fill" doesn't support correctly a negative number
as first parameter.
If start_index is negative, then it starts with the correct value, but
the next key value is always 0.
I guess could have the answer in the bug 24159...
Maybe the documentation have to be updated, or (I hope it will be this
solution) the function array_fill have to fixed :-P
Thx for all!
Reproduce code:
---------------
<?php
print_r(array_fill(-3,5,0));
?>
Expected result:
----------------
Array
(
[-3] => 0
[-2] => 0
[-1] => 0
[0] => 0
[1] => 0
)
Actual result:
--------------
Array
(
[-3] => 0
[0] => 0
[1] => 0
[2] => 0
[3] => 0
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40882&edit=1