I'm trying to figure out how to implode a json array coming from an axios call, within a php file. I currently have this function where I toggle between dumping out the array and then trying to dump the imploded version but that fails stating that it's an invalid argument for a foreach.
PHP file:
public function getResults(array $num = []){
dd($num);
dd(implode(", ", array_map(function($obj) { foreach ($obj as $p => $v) { return $p;} }, $num)));
}
The dd($num) call shows this in my network console:
array:2 [
0 => "{"number":"115"}"
1 => "{"number":"135"}"
]
How can I implode this to look like 115,135
?