我搜索了如何同时推送键和值,我发现了这个:如何将值和键都推送到数组中
但我的问题是如何将多个键和值添加到数组中?
$somearray
:
Array (
[id] => 1645819602
[name] => Michael George)
我想将此添加到$somearray
:
[first_name] => Michael
[last_name] => George
[work] => Google
所以输出将是
Array (
[id] => 1645819602
[name] => Michael George
[first_name] => Michael
[last_name] => George
[work] => Google)
我知道这段代码行不通
$arrayname[first_name] = Michael;
$arrayname[last_name] = George;
$arrayname[work] = Google;
任何帮助将不胜感激。谢谢