I have the following array called $thumbs_meta
and I want to get all of the filenames from the sizes
subarray so that I can count them and glue them together into a comma-separated string.
Array
(
[width] => 1024
[height] => 768
[file] => 2018/08/Penguins.jpg
[sizes] => Array
(
[thumbnail] => Array
(
[file] => Penguins-150x150.jpg
[width] => 150
[height] => 150
[mime-type] => image/jpeg
)
[medium] => Array
(
[file] => Penguins-300x225.jpg
[width] => 300
[height] => 225
[mime-type] => image/jpeg
)
[medium_large] => Array
(
[file] => Penguins-768x576.jpg
[width] => 768
[height] => 576
[mime-type] => image/jpeg
)
[large] => Array
(
[file] => Penguins-1024x768.jpg
[width] => 1024
[height] => 768
[mime-type] => image/jpeg
)
[twentyseventeen-thumbnail-avatar] => Array
(
[file] => Penguins-100x100.jpg
[width] => 100
[height] => 100
[mime-type] => image/jpeg
)
)
)
I tried foreach, but it's one step more so it's not working. Should I loop twice?
Here is my present foreach which does not work:
foreach($thumbs_meta as $key => $value) {
$fullname .=$value['file'].',';
}
$thumbs_count = count( $thumbs_meta );
Specifically, I want to isolate the file
values from these keys: thumbnail
, medium
, large
, medium_large
, and twentyseventeen-thumbnail-avatar
My expected count would be 5
My comma-separated string would be:
Penguins-150x150.jpg,Penguins-300x225.jpg,Penguins-768x576.jpg,Penguins-1024x768.jpg,Penguins-100x100.jpg