Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试循环一个 foreach 数组并将新值添加到同一个数组中,但它没有返回值;
<?php foreach($departments as $department){ $department['users'] = 10; } ?>
但是当我返回数组时,“用户”不会成为列表的一部分。我尝试了array_push,也没有太多运气。
使用参考:
foreach($departments as &$department){ $department['users'] = 10; }