array(3) { [0]=> array(1) { ["id"]=> int(852) } [1]=> array(1) { ["id"]=> int(853) } [2]=> array(1) { ["id"]=> int(854) } }
How to add an id of 845 to such an array and then turn the array
into a string of 852,853,854, 845?
習慣沉默2017-05-24 11:35:51
$arr=[['id'=>852],['id'=>853],['id'=>854]];
foreach ($arr as $key => $value) {
$new[]=implode('',$value);
}
$new[]='845';
$new=implode(',',$new);
var_dump($new);
滿天的星座2017-05-24 11:35:51
$ARR [] = ['id'=>845];
The subsequent transformation was answered downstairs
淡淡烟草味2017-05-24 11:35:51
$arr = array(
array('id' => 852),
array('id' => 853),
array('id' => 854),
);
$arr[] = array('id' => 845);
$arr = array_column($arr, 'id');
$str = implode(',', $arr);
var_dump($str);