ID: 43424 Updated by: [EMAIL PROTECTED] Reported By: dharma dot yp at in dot ibm dot com -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: Linux, windows PHP Version: 5.2CVS-2007-11-27 (snap) New Comment:
If you look closely at the var_dump() output you'll notice that they're not floats but strings. This is expected and correct behaviour. Previous Comments: ------------------------------------------------------------------------ [2007-11-27 12:43:38] dharma dot yp at in dot ibm dot com Description: ------------ when array with float values is passed to $keys argument of array_combine()function, it creates an array with float keys and the values specified by $values argument. This is in contradiction with the array documentation, which specifies that only integers or strings can be used as keys in an array.Same can be found in the below link. http://in2.php.net/manual/en/language.types.array.php So, either of the below is expected: 1) An error message saying that float values can't be used as keys for an array should be output or 2) float keys should be truncated to integer keys. This behaviour can be found with PHP5.3 and PHP6 as well. Reproduce code: --------------- <?php $arr1 = array(1.1, 2.2); $arr2 = array(1, 2); var_dump( array_combine($arr1, $arr2) ); ?> Expected result: ---------------- array(2) { [1]=> int(1) [2]=> int(2) } Actual result: -------------- array(2) { ["1.1"]=> int(1) ["2.2"]=> int(2) } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43424&edit=1