Multi dimentional arrays JSON & PHP

Discussion in 'Programming' started by frobak, Jul 13, 2011.

  1. #1
    Hi

    Im making a facebook app and i need to access the 3rd level data in a JSON array, ive managed to output the first 2, but then im getting an invalid argument.

    I want to replicate the wall function

    The below code outputs the top 2 arrays no problem

    $feeds = $facebook->api('/255500227799817/feed');
    
    foreach($feeds['data'] as $feed => $list) {
    	echo "<h2>$feed</h2><ul>";
    	foreach($list as $k => $v) {
    			echo "<li>$k - $v</li>\n";
    	}
    	echo "</ul>";
    }
    PHP:
    this is the output

        id - 255500227799817_255522881130885
        from - Array
        message - just another status update
        actions - Array
        type - status
        created_time - 2011-07-13T10:57:13+0000
        updated_time - 2011-07-13T10:57:13+0000
    
    Code (markup):
    So i need to access and display the 'from' array and the 'actions' array

    Can i do this by amending the above php function?
     
    frobak, Jul 13, 2011 IP