使用 array_push($var);带钥匙
$dizi = array(
"tr" => "Turkey",
"uk" => "United Kingdom",
"us" => "United States"
);
我想将 "br"==>"brasil"
添加到数组末尾。
谢谢。
$dizi = array(
"tr" => "Turkey",
"uk" => "United Kingdom",
"us" => "United States"
);
i want to add "br"=>"brasil"
to end of the array.
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
没什么可说的:
There's nothing to it:
与
array_push
更接近的语法结构是:注意 + =
但对于单个添加,您应该更喜欢直接数组分配(如其他答案中指出的)。
A syntax construct that's a bit closer to
array_push
would be:Note the +=
But for a single addition you should prefer the direct array assignment (as pointed out in the other answers).
你可以这样做:
you could just do: