<?php
$str1 = array("key1"=>"aa","key2"=>"bb","key3"=>"cc");
$ret = array_splice($str1,1,0,array("key9"=>"xx"));
print '----- $str1 -----'."\n";
var_dump( $str1);
print '----- $ret -----'."\n";
var_dump( $ret);
?>
●実行結果
----- $str1 -----
array(4) {
["key1"]=>
string(2) "aa"
[0]=>
string(2) "xx"
["key2"]=>
string(2) "bb"
["key3"]=>
string(2) "cc"
}
----- $ret -----
array(0) {
}
|