如何更新该数组中的特定值? (php)
我有以下数组 $cart
,其结构如下:
Array
(
[0] => Array
(
[sku] => TEST1
[size] => s
[qty] => 1
)
)
如何使用 php 直接将数量更新为 2,而不使用 foreach 循环(注意。假设我有索引值 (0)已经)。
谢谢
I have the following array, $cart
which is structured like so:
Array
(
[0] => Array
(
[sku] => TEST1
[size] => s
[qty] => 1
)
)
how can I update the qty to 2 directly using php and not using a foreach loop (nb. assume I have the index value (0) already).
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
像这样:
Like this:
除非我在这里遗漏了一些内容,否则如果您已经知道要更新索引 0:
Unless I'm missing something here, if you already know you want to update index 0: