Date: 05/23/01
- Next message: bbonev <email protected>: "[PHP-DEV] Bug #11010 Updated: current cvs cannot configure"
- Previous message: symetrie <email protected>: "[PHP-DEV] Bug #11073: parent::Function() does not work if parent class is included"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: symetrie <email protected>
Operating system: Linux SuSE 6.4
PHP version: 4.0.4pl1
PHP Bug Type: Arrays related
Bug description: array_splice used to insert associative array forgets first key
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 Bug report at: http://bugs.php.net/?id=11074&edit=1-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: bbonev <email protected>: "[PHP-DEV] Bug #11010 Updated: current cvs cannot configure"
- Previous message: symetrie <email protected>: "[PHP-DEV] Bug #11073: parent::Function() does not work if parent class is included"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

