thanks in advance for any help! I´m an absolute newbie to php but trying to get along.
I have an array $result which contains something like:
Array
(
[0] => Array
(
[id] => xyz
[from] => Array
(
[name] => xyz
[id] => xyz
)
[link] => xyz
[name] => xyz
[picture] => xyz
[created_time] => xyz
)
[1] => Array
(
[id] => xyz
[from] => Array
(
[name] => xyz
[id] => xyz
)
[link] => xyz
[name] => xyz
[picture] => xyz
[created_time] => xyz
)
And so on... .
What I want to achieve is a foreach loop that works with some of those information. For now I changed the code to simply output the info, so I can see the problems...I think. My Code is:
foreach($result AS $buildresult) {
$resobjid = array_column($buildresult, 'id');
$cardpicurl = "https://graph.facebook.com/$resobjid/picture";
$heading = array_column($buildresult ['from'], 'name');
$para = array_column($buildresult, 'name');
$link = array_column($buildresult, 'link');
echo '<pre>' . print_r( $resobjid, 1 ) . '</pre><br>';
echo '<pre>' . print_r( $cardpicurl, 1 ) . '</pre><br>';
echo '<pre>' . print_r( $heading, 1 ) . '</pre><br>';
echo '<pre>' . print_r( $para, 1 ) . '</pre><br>';
echo '<pre>' . print_r( $link, 1 ) . '</pre><br>';
echo '<pre>' . print_r( $cardpicurl, 1 ) . '</pre><br>';
echo '<pre>' . print_r( $buildresult, 1 ) . '</pre><br>';
}
Im expecting it to do something like:
The ID
https://graph.facebook.com/someidfromthearray/picture
Array
(
[0] => Some Name from the Array
)
Array
(
[0] => Some Name from the above array
)
But what I get is:
Array
(
[0] => 387639951329150
)
https://graph.facebook.com/Array/picture
Array
(
)
Array
(
[0] => Some.Name
)
Array
(
)
https://graph.facebook.com/Array/picture
So I do get the ID and the name from the "from" array. The rest seems empty. As well the https://graph.facebook.com/$resobjid/picture
shows "Array" despite showing up correctly within echo '<pre>' . print_r( $resobjid, 1 ) . '</pre><br>';
Any help is highly appreciated!
Thanks a lot! :)