Array
(
[0] => Array
(
[num] => 338975270
)
[1] => Array
(
[num] => 4542682328
)
)
now i want to use implode function to get output like :
(338975270,4542682328)
You should ..
echo "(".implode(',', array_map(function ($v){ return $v['num'];},$yourarray)).")";
Working Demo
You can't directly use implode()
on a MD array. So use an array_map()
to grab all those values with num key and then subject that to your implode()
.
This should solve your problem
$result = implode(',',array_column($a,'num')));
Extract values and implode them
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With