|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-12-19 15:54 UTC] 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"
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 13:00:01 2025 UTC |
Just a question... Why is this the decided upon behavior? Is there any way to implement a flexible/variable "struct"-like data structure with the ability to have numeric strings ("8") that aren't converted to ints/longs? This unfortunately is now a serious issue for my company, and I'm pulling out my hair! :( any help/advice?