Ask a Question related to PHP Development, Design and Development.
-
helly@php.net #1
#8325 [Opn->Bgs]: numeric strings used as keys are converted to longs
ID: 8325
Updated by: [email]helly@php.net[/email]
Reported By: cynic at mail dot cz
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
Operating System: *
PHP Version: 4.0 Latest CVS (19/12/2000)
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
[url]http://www.php.net/manual/[/url] and the instructions on how to report
a bug at [url]http://bugs.php.net/how-to-report.php[/url]
Indexes with numerical vales (zero or positive) are casted to integer.
Previous Comments:
------------------------------------------------------------------------
[2003-02-08 12:36:42] [email]moriyoshi@php.net[/email]
Related to bug #21918
------------------------------------------------------------------------
[2000-12-19 15:54:22] cynic at mail dot cz
(Actually, this is for PHP 4 versions up to 4.0.4 RC6, but it ain't in
the version list.)
I don't want to sound harsh or something, and this behavior seemed to
be accepted as feature from what I saw elsewhere in the bug database
(can't find it, though), but I think it shouldn't be that way.
Current behavior:
<?
$p = 1 ;
settype( $p , 'string' ) ;
$a = array( $p => 'aaaa' ) ;
var_dump( $a ) ;
?>
output (note: casting within the array() doesn't help):
string(1) "1"
array(1) {
[1]=>
string(4) "aaaa"
}
'Right' (YMMV) behavior:
string(1) "1"
array(1) {
["1"]=>
string(4) "aaaa"
}
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=8325&edit=1[/url]
helly@php.net Guest
-
#24652 [Asn->Csd]: array keys that are strings but numeric behave incorrectly
ID: 24652 Updated by: zeev@php.net Reported By: tater at potatoe dot com -Status: Assigned +Status: ... -
#24652 [Fbk->Asn]: array keys that are strings but numeric behave incorrectly
ID: 24652 Updated by: sniper@php.net Reported By: tater at potatoe dot com -Status: Feedback +Status: ... -
#21788 [Sus->WFx]: array_multisort() changes array keys unexpectedly given numeric strings as keys
ID: 21788 Updated by: sniper@php.net Reported By: jon at inet-specialists dot com -Status: Suspended +Status: ... -
#24652 [Opn->Fbk]: array keys that are strings but numeric behave incorrectly
ID: 24652 Updated by: kalowsky@php.net Reported By: tater at potatoe dot com -Status: Open +Status: ... -
#24652 [Com]: array keys that are strings but numeric behave incorrectly
ID: 24652 Comment by: Nico dot Laus dot 2001 at gmx dot de Reported By: tater at potatoe dot com Status: Open...



Reply With Quote

