#8325 [Com]: numeric strings used as keys are converted to longs
ID: 8325 Comment by: alternateduh at hotmail dot com Reported By: cynic at mail dot cz Status: Bogus Bug Type: Feature/Change Request Operating System: * PHP Version: 4.0 Latest CVS (19/12/2000) New Comment: Actually it is very important for us for some database and xmlrpc code that depends on critical data types that cannot change types. As the strings go to ints, the code later believes that the indicies are ints instead of strings, and unfortunately sql syntaxes and xmlrpc data types no longer match. :( Previous Comments: [2004-05-19 02:31:17] papercrane at reversefold dot com Why exactly is this important? You can still access the array fine can't you? $arr["8"] = 2; echo $arr["8"]; That works fine for me. Perhaps you have numbers longer than that that it's choking on? It seems that if you add a 0 at the beginning, PHP will leave it as a string. $arr["08"] = 2; var_dump($arr); [2004-05-19 02:15:11] alternateduh at hotmail dot com 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? [2003-08-10 20:16:39] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Indexes with numerical vales (zero or positive) are casted to integer. [2003-02-08 12:36:42] [EMAIL PROTECTED] 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: '' ) ; var_dump( $a ) ; ?> output (note: casting within the array() doesn't help): string(1) "1" array(1) { [1]=> string(4) "" } 'Right' (YMMV) behavior: string(1) "1" array(1) { ["1"]=> string(4) "" } -- Edit this bug report at http://bugs.php.net/?id=8325&edit=1
#8325 [Com]: numeric strings used as keys are converted to longs
ID: 8325 Comment by: papercrane at reversefold dot com Reported By: cynic at mail dot cz Status: Bogus Bug Type: Feature/Change Request Operating System: * PHP Version: 4.0 Latest CVS (19/12/2000) New Comment: Why exactly is this important? You can still access the array fine can't you? $arr["8"] = 2; echo $arr["8"]; That works fine for me. Perhaps you have numbers longer than that that it's choking on? It seems that if you add a 0 at the beginning, PHP will leave it as a string. $arr["08"] = 2; var_dump($arr); Previous Comments: [2004-05-19 02:15:11] alternateduh at hotmail dot com 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? [2003-08-10 20:16:39] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Indexes with numerical vales (zero or positive) are casted to integer. [2003-02-08 12:36:42] [EMAIL PROTECTED] 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: '' ) ; var_dump( $a ) ; ?> output (note: casting within the array() doesn't help): string(1) "1" array(1) { [1]=> string(4) "" } 'Right' (YMMV) behavior: string(1) "1" array(1) { ["1"]=> string(4) "" } -- Edit this bug report at http://bugs.php.net/?id=8325&edit=1
#8325 [Com]: numeric strings used as keys are converted to longs
ID: 8325 Comment by: alternateduh at hotmail dot com Reported By: cynic at mail dot cz Status: Bogus Bug Type: Feature/Change Request Operating System: * PHP Version: 4.0 Latest CVS (19/12/2000) New Comment: 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? Previous Comments: [2003-08-10 20:16:39] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Indexes with numerical vales (zero or positive) are casted to integer. [2003-02-08 12:36:42] [EMAIL PROTECTED] 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: '' ) ; var_dump( $a ) ; ?> output (note: casting within the array() doesn't help): string(1) "1" array(1) { [1]=> string(4) "" } 'Right' (YMMV) behavior: string(1) "1" array(1) { ["1"]=> string(4) "" } -- Edit this bug report at http://bugs.php.net/?id=8325&edit=1