ID:               11074
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Bogus
 Bug Type:         Arrays related
 Operating System: Linux SuSE 6.4
 PHP Version:      4.0.4pl1
 New Comment:

The version of PHP that this bug was reported in is too old. Please
try to reproduce this bug in the latest version of PHP (available
from http://www.php.net/downloads.php

If you are still able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".




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

[2001-05-23 22:04:42] [EMAIL PROTECTED]

It seems to be impossible to replace a key in associative array with
another array : array_splice always add a '0' key... Feature or bug ?
<?php
        $a = array("a" => "AA", "b" => "BB", "c" => "CC");
        $a2 = $a;
        $z = array("z" => array("z1"=>"ZZ1","z2"=>"ZZ2"), "x" =>"XX");
        
        // 1 try to replace "b"=>"BB" by contents of $z
        array_splice($a, 1, 1, $z);
        print_r($a);
// produces : Array ( [a] => AA [0] => Array ( [z1] => ZZ1 [z2] => ZZ2
) [1] => XX [c] => CC ) 
        
        echo "<hr>";
        
        // 2 try to replace "b"=>"BB" by contents of $z as in manual
        array_splice($a, 1, 1, array($z));
        print_r($a);
// produces : Array ( [a] => AA [0] => Array ( [z] => Array ( [z1] =>
ZZ1 [z2] => ZZ2 ) [x] => XX ) [1] => XX [c] => CC ) 
// I'd like :
// Array ( [a] => AA [z] => Array ( [z1] => ZZ1 [z2] => ZZ2 ) [1] => XX
[c] => CC ) 
?>

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


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

Reply via email to