I'm trying to pluck a value from a multidimensional (I think that's the term) array and append it to a string variable. It's a POST to Laravel from a JSON array.
The array:
0:
icon: "nanny"
name: "Nanny"
order: 1
price: 3000
selected: true
1:
icon: "driver"
name: "Driver"
order: 3
price: 2000
selected: true
I want to get the value of name and append it to a variable as a string.
$items = 'Nanny, Driver, '
This is my attempt
$items = '';
foreach($request->services as $service) {
foreach ($service as $key => $value) {
$items .= $key['name'] . ', ';
}
}