I need to get the values ($ src), within this foreach, of each key separately in that array:
<?php
foreach( get_post_gallery( $post->id, false ) as $key => $src ) {
echo $key; //resultado: link, size - ids - src
echo $src; //resultado: file, full - 61,59,57,41 - Array
}
?>
This is the complete array in var_dump();
<?php
array(4) {
["link"]=> string(4) "file"
["size"]=> string(4) "full"
["ids"]=> string(11) "61,59,57,41"
["src"]=> array(4) {
[0]=> string(83) "http://localhost/1.jpg"
[1]=> string(94) "http://localhost/2.jpg"
[2]=> string(62) "http://localhost/3.jpg"
[3]=> string(68) "http://localhost/4.jpg"
}
}
?>
UPDATE
I wanted to be able to mount the result like this:
<?php
array(4) {
["link"]=> string(4) "file"
["size"]=> string(4) "full"
["ids"]=> array(4) {
[0]=> string(83) "61"
[1]=> string(94) "59"
[2]=> string(62) "57"
[3]=> string(68) "41"
}
["src"]=> array(4) {
[0]=> string(83) "http://localhost/1.jpg"
[1]=> string(94) "http://localhost/2.jpg"
[2]=> string(62) "http://localhost/3.jpg"
[3]=> string(68) "http://localhost/4.jpg"
}
}
?>