public function getPhotos($id_album){
$hisPhoto = '123';
$myPhoto = '456';
$herPhoto = '789';
$id_user = 1;
$photoTable = array
(
'hisPhoto' => $hisPhoto,
'myPhoto' => $myPhoto,
'herPhoto' => $herPhoto,
);
return array
(
'id_user' => $id_user,
'photos' => $photoTable
)
}
$photos = getPhotos($id_album);
I have no idea how to use associative array in associative array. What is the simplest way using this function to get to the my photo (value '456')?
$photos
will end up having the structure:
Array
(
'id_user' => $id_user,
'photos' =>
Array
(
'hisPhoto' => $hisPhoto,
'myPhoto' => $myPhoto,
'herPhoto' => $herPhoto
)
)
So you can just go:
echo $photos['photos']['myPhoto'];
If you are stuck with the structure of an array you can use:
print_r($array);
To view the structure