PHP array transformation expert enters
淡淡烟草味
淡淡烟草味 2017-05-24 11:33:51
0
4
653
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?

淡淡烟草味
淡淡烟草味

reply all(4)
習慣沉默
 $arr=[['id'=>852],['id'=>853],['id'=>854]];
    foreach ($arr as $key => $value) {
    $new[]=implode('',$value);
    }
    $new[]='845';
    $new=implode(',',$new);
    var_dump($new);
滿天的星座

$ARR [] = ['id'=>845];
The subsequent transformation was answered downstairs

淡淡烟草味
$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);
滿天的星座

The same error message is reported when you run it alone

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template