#40882 [Bgs->Asn]: array_fill with negative start index not documented

From: Date: Wed, 20 Feb 2008 15:55:05 +0000
Subject: #40882 [Bgs->Asn]: array_fill with negative start index not documented
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-531@lists.php.net to get a copy of this message
ID: 40882 Updated by: nicholsr@php.net -Summary: Ãrray_fill doesn't support negative start index Reported By: guile_spam at laposte dot net -Status: Bogus +Status: Assigned -Bug Type: Arrays related +Bug Type: Documentation problem Operating System: Linux ~~~~ 2.6.12-12mdk #1 F PHP Version: 5.2.1 -Assigned To: +Assigned To: nicholsr New Comment: I was about to open the same problem all over again when I found this. It seems to me that this problem is not really bogus but actually a documentation problem. array_fill documentation should be changed to indicate that if the starting index is negative it will be used for the first entry but subsequent entries start from zero. Assigning to myself. Not sure when I'll get around to updating the documentation but its better to have a bug open than not to. Previous Comments: ------------------------------------------------------------------------ [2007-03-22 10:25:28] tony2001@php.net >I guess could have the answer in the bug 24159... Right, so this is expected. ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#531) next »