How to store values from foreach loop into an array?

前端 未结 8 905
我在风中等你
我在风中等你 2020-11-29 16:16

Need to store values from foreach loop into an array, need help doing that.

The code below does not work, only stores the last value, tried $items .= ...,

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-29 16:33

    Just to save you too much typos:

    foreach($group_membership as $username){
            $username->items = array(additional array to add);
        }
        print_r($group_membership);
    

提交回复
热议问题