ID:               44825
 User updated by:  dmitrij at stepanov dot lv
 Reported By:      dmitrij at stepanov dot lv
 Status:           Bogus
 Bug Type:         Arrays related
 Operating System: Windows XP
 PHP Version:      5.2.5
 New Comment:

OMG.


Previous Comments:
------------------------------------------------------------------------

[2008-04-24 21:45:06] [EMAIL PROTECTED]

Negative!

Says the documentation:
"A key may be either an integer or a string... Floats in key are
truncated to integer."

$ php -r '$a[2.3] = "foo"; var_dump($a);'
array(1) {
  [2]=>
  string(3) "foo"
}


------------------------------------------------------------------------

[2008-04-24 21:41:58] dmitrij at stepanov dot lv

Description:
------------
array_key_exists() does not accept float as a key. (The first argument
should be either a string or an integer), however it is possible to use
floats as keys.

Reproduce code:
---------------
$array =array(
 3.15 =>20);
var_dump( array_key_exists( 3.15, $array)) ."\n";// ERROR: The first
argument should be either a string or an integer
echo $array[3.15];//OK

Expected result:
----------------
boolean(true)
20

Actual result:
--------------
blahblahblah
20


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44825&edit=1

Reply via email to