$array1=Array
(
[Apr] => stdClass Object
(
[months] => 0
[years] => 0
[totbooking] => 0
[nights] => 0
[revenue] => 0
[adr] => 0
[atp] => 0
[leadtime] => 0
[alos] => 0
[share] => 0.60463290145269
)
)
$array2=Array
(
[Apr] => stdClass Object
(
[months] => Apr
[years] => 2016
[totbooking] => 73
[nights] => 154
[revenue] => 26375
[adr] => 171
[atp] => 361
[leadtime] => 24
[alos] => 2.1096
[share] => 0
)
)
我想替换分享。所以新阵列看起来像
Array
(
[Apr] => stdClass Object
(
[months] => Apr
[years] => 2016
[totbooking] => 73
[nights] => 154
[revenue] => 26375
[adr] => 171
[atp] => 361
[leadtime] => 24
[alos] => 2.1096
[share] => 0.60463290145269
)
)
答案 0 :(得分:0)
我认为这对您也有用:
$arr[$newkey] = $arr[$oldkey];
unset($arr[$oldkey]);