ID:               21918
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Verified
 Bug Type:         Arrays related
 Operating System: Linux
-PHP Version:      4.3.0
+PHP Version:      4.3.0/5.0.0
 New Comment:

Verified under PHP 4.3.0 with Zend Engine v1.3.0 and PHP 5.0.0-dev with
Zend Engine v2.0.0-dev.

It looks like '-1' isn't casted to int as it should.




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

[2003-01-28 04:58:13] [EMAIL PROTECTED]

<?php

$a = array(-1=>1,
           '-1'=>2,
           0=>3,
           '0'=>4,
           1=>5,
           '1'=>6
           );

print_r($a);

?>

produces:
Array
(
    [-1] => 1
    [-1] => 2
    [0] => 4
    [1] => 6
)


foreach (array_keys($a) as $key) echo $key, ': ', gettype($key), "\n";
produces:
-1: integer
-1: string
0: integer
1: integer

so it seems strings containing negative integers do not get converted
to
integers automagically but positive integers are.



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


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

Reply via email to