我的例子如下:
Array
(
[0] => stdClass Object
(
[user_id] => 8
[users] => 1
)
[1] => stdClass Object
(
[user_id] => 8
[users] => 18,19
)
)
我需要运行foreach循环并最终得到类似:
Array
(
[0] => stdClass Object
(
[user_id] => 8
[users] => 1,8
)
[1] => stdClass Object
(
[user_id] => 8
[users] => 18,19,8
)
)
这样[user_id]和[users]组合成[users]
答案 0 :(得分:0)
你的foreach,
foreach( $arrObjects as $object ) {
$object->users = $object->'users'.','.$object->user_id;
}
你应该首先弄清楚你将如何接近它并发布你试图解决问题的方法。