How to access data from this array file using PHP?












1















This is the data using var_export($result);



 array ( 0 => array ( 'album' => array ( 'album_type' => 'ALBUM', 'artists' => array ( 0 => array ( 'external_urls' => array ( 'spotify' => 'https://open.spotify.com/artist/6rBvjnvdsRxFRSrq1StGOM', ), 'href' => 'https://api.spotify.com/v1/artists/6rBvjnvdsRxFRSrq1StGOM', 'id' => '6rBvjnvdsRxFRSrq1StGOM', 'name' => 'Bathory', 'type' => 'artist', 'uri' => 'spotify:artist:6rBvjnvdsRxFRSrq1StGOM', ), ), 'external_urls' => array ( 'spotify' => 'https://open.spotify.com/album/1ZN0dVt3JGTUJZ5TydY1E8', ), 'href' => 'https://api.spotify.com/v1/albums/1ZN0dVt3JGTUJZ5TydY1E8', 'id' => '1ZN0dVt3JGTUJZ5TydY1E8', 'images' => array ( 0 => array ( 'height' => 640, 'url' => 'https://i.scdn.co/image/ba052dff3d3cf0f5bd9b66a7ac707c2f4dfad065', 'width' => 640, ), 1 => array ( 'height' => 300, 'url' => 'https://i.scdn.co/image/20b02fb5aae2cfe790adb6b65433850a0977542c', 'width' => 300, ), 2 => array ( 'height' => 64, 'url' => 'https://i.scdn.co/image/668e5fb3a1044d4a2d7a90d3491612fe702d558b', 'width' => 64, ), ), 'name' => 'Blood Fire Death', 'type' => 'album', 'uri' => 'spotify:album:1ZN0dVt3JGTUJZ5TydY1E8', ), 'artists' => array ( 0 => array ( 'external_urls' => array ( 'spotify' => 'https://open.spotify.com/artist/6rBvjnvdsRxFRSrq1StGOM', ), 'href' => 'https://api.spotify.com/v1/artists/6rBvjnvdsRxFRSrq1StGOM', 'id' => '6rBvjnvdsRxFRSrq1StGOM', 'name' => 'Bathory', 'type' => 'artist', 'uri' => 'spotify:artist:6rBvjnvdsRxFRSrq1StGOM', ), ), 'disc_number' => 1, 'duration_ms' => 220200, 'explicit' => false, 'external_ids' => array ( 'isrc' => 'SEXHQ8800404', ), 'external_urls' => array ( 'spotify' => 'https://open.spotify.com/track/0i6joqNGcGa73MXEi1qVJi', ), 'href' => 'https://api.spotify.com/v1/tracks/0i6joqNGcGa73MXEi1qVJi', 'id' => '0i6joqNGcGa73MXEi1qVJi', 'is_playable' => true, 'name' => 'Pace Till Death', 'popularity' => 28, 'preview_url' => 'https://p.scdn.co/mp3-preview/572b24bf4fae0a7ce5ef835b5dc5c60826c4bc79?cid=24974f52d3fc4029a03bee338698b062', 'track_number' => 4, 'type' => 'track', 'uri' => 'spotify:track:0i6joqNGcGa73MXEi1qVJi', ), )


How do I access this part of the current file below



[images] => Array ( [0] => Array ( [height] => 640 [url] => https://i.scdn.co/image/f57171446c8d61050af0e43726c4863dfdc235a4 [width] => 640 ) [1] => Array ( [height] => 300 [url] => https://i.scdn.co/image/4111d12bb7e3a142d12309ba699ce97d78fd8905 


Using PHP how do I display this data above I've tried the below which retrieves the name, however, I want the image as shown above. Note that $result is where I store the results from the API



$result = json_decode(json_encode($result), true);

foreach($result as $obj){

echo "Name : " . $obj['name'];
}









share|improve this question




















  • 2





    Isn't this basic array accessing?

    – Jeto
    Nov 17 '18 at 10:28






  • 1





    Can you add to outcome of var_export($result);?

    – The fourth bird
    Nov 17 '18 at 10:29











  • Would this be easier , if I turned it into json format? how may I do this?

    – John
    Nov 17 '18 at 10:32











  • @Thefourthbird the var_export($result) is the same as the data above in my question detials

    – John
    Nov 17 '18 at 10:42






  • 1





    @John If you want the 'images' array, try it like this: foreach($result as $obj){ print_r($obj['album']['images']); }

    – The fourth bird
    Nov 17 '18 at 11:03


















1















This is the data using var_export($result);



 array ( 0 => array ( 'album' => array ( 'album_type' => 'ALBUM', 'artists' => array ( 0 => array ( 'external_urls' => array ( 'spotify' => 'https://open.spotify.com/artist/6rBvjnvdsRxFRSrq1StGOM', ), 'href' => 'https://api.spotify.com/v1/artists/6rBvjnvdsRxFRSrq1StGOM', 'id' => '6rBvjnvdsRxFRSrq1StGOM', 'name' => 'Bathory', 'type' => 'artist', 'uri' => 'spotify:artist:6rBvjnvdsRxFRSrq1StGOM', ), ), 'external_urls' => array ( 'spotify' => 'https://open.spotify.com/album/1ZN0dVt3JGTUJZ5TydY1E8', ), 'href' => 'https://api.spotify.com/v1/albums/1ZN0dVt3JGTUJZ5TydY1E8', 'id' => '1ZN0dVt3JGTUJZ5TydY1E8', 'images' => array ( 0 => array ( 'height' => 640, 'url' => 'https://i.scdn.co/image/ba052dff3d3cf0f5bd9b66a7ac707c2f4dfad065', 'width' => 640, ), 1 => array ( 'height' => 300, 'url' => 'https://i.scdn.co/image/20b02fb5aae2cfe790adb6b65433850a0977542c', 'width' => 300, ), 2 => array ( 'height' => 64, 'url' => 'https://i.scdn.co/image/668e5fb3a1044d4a2d7a90d3491612fe702d558b', 'width' => 64, ), ), 'name' => 'Blood Fire Death', 'type' => 'album', 'uri' => 'spotify:album:1ZN0dVt3JGTUJZ5TydY1E8', ), 'artists' => array ( 0 => array ( 'external_urls' => array ( 'spotify' => 'https://open.spotify.com/artist/6rBvjnvdsRxFRSrq1StGOM', ), 'href' => 'https://api.spotify.com/v1/artists/6rBvjnvdsRxFRSrq1StGOM', 'id' => '6rBvjnvdsRxFRSrq1StGOM', 'name' => 'Bathory', 'type' => 'artist', 'uri' => 'spotify:artist:6rBvjnvdsRxFRSrq1StGOM', ), ), 'disc_number' => 1, 'duration_ms' => 220200, 'explicit' => false, 'external_ids' => array ( 'isrc' => 'SEXHQ8800404', ), 'external_urls' => array ( 'spotify' => 'https://open.spotify.com/track/0i6joqNGcGa73MXEi1qVJi', ), 'href' => 'https://api.spotify.com/v1/tracks/0i6joqNGcGa73MXEi1qVJi', 'id' => '0i6joqNGcGa73MXEi1qVJi', 'is_playable' => true, 'name' => 'Pace Till Death', 'popularity' => 28, 'preview_url' => 'https://p.scdn.co/mp3-preview/572b24bf4fae0a7ce5ef835b5dc5c60826c4bc79?cid=24974f52d3fc4029a03bee338698b062', 'track_number' => 4, 'type' => 'track', 'uri' => 'spotify:track:0i6joqNGcGa73MXEi1qVJi', ), )


How do I access this part of the current file below



[images] => Array ( [0] => Array ( [height] => 640 [url] => https://i.scdn.co/image/f57171446c8d61050af0e43726c4863dfdc235a4 [width] => 640 ) [1] => Array ( [height] => 300 [url] => https://i.scdn.co/image/4111d12bb7e3a142d12309ba699ce97d78fd8905 


Using PHP how do I display this data above I've tried the below which retrieves the name, however, I want the image as shown above. Note that $result is where I store the results from the API



$result = json_decode(json_encode($result), true);

foreach($result as $obj){

echo "Name : " . $obj['name'];
}









share|improve this question




















  • 2





    Isn't this basic array accessing?

    – Jeto
    Nov 17 '18 at 10:28






  • 1





    Can you add to outcome of var_export($result);?

    – The fourth bird
    Nov 17 '18 at 10:29











  • Would this be easier , if I turned it into json format? how may I do this?

    – John
    Nov 17 '18 at 10:32











  • @Thefourthbird the var_export($result) is the same as the data above in my question detials

    – John
    Nov 17 '18 at 10:42






  • 1





    @John If you want the 'images' array, try it like this: foreach($result as $obj){ print_r($obj['album']['images']); }

    – The fourth bird
    Nov 17 '18 at 11:03
















1












1








1








This is the data using var_export($result);



 array ( 0 => array ( 'album' => array ( 'album_type' => 'ALBUM', 'artists' => array ( 0 => array ( 'external_urls' => array ( 'spotify' => 'https://open.spotify.com/artist/6rBvjnvdsRxFRSrq1StGOM', ), 'href' => 'https://api.spotify.com/v1/artists/6rBvjnvdsRxFRSrq1StGOM', 'id' => '6rBvjnvdsRxFRSrq1StGOM', 'name' => 'Bathory', 'type' => 'artist', 'uri' => 'spotify:artist:6rBvjnvdsRxFRSrq1StGOM', ), ), 'external_urls' => array ( 'spotify' => 'https://open.spotify.com/album/1ZN0dVt3JGTUJZ5TydY1E8', ), 'href' => 'https://api.spotify.com/v1/albums/1ZN0dVt3JGTUJZ5TydY1E8', 'id' => '1ZN0dVt3JGTUJZ5TydY1E8', 'images' => array ( 0 => array ( 'height' => 640, 'url' => 'https://i.scdn.co/image/ba052dff3d3cf0f5bd9b66a7ac707c2f4dfad065', 'width' => 640, ), 1 => array ( 'height' => 300, 'url' => 'https://i.scdn.co/image/20b02fb5aae2cfe790adb6b65433850a0977542c', 'width' => 300, ), 2 => array ( 'height' => 64, 'url' => 'https://i.scdn.co/image/668e5fb3a1044d4a2d7a90d3491612fe702d558b', 'width' => 64, ), ), 'name' => 'Blood Fire Death', 'type' => 'album', 'uri' => 'spotify:album:1ZN0dVt3JGTUJZ5TydY1E8', ), 'artists' => array ( 0 => array ( 'external_urls' => array ( 'spotify' => 'https://open.spotify.com/artist/6rBvjnvdsRxFRSrq1StGOM', ), 'href' => 'https://api.spotify.com/v1/artists/6rBvjnvdsRxFRSrq1StGOM', 'id' => '6rBvjnvdsRxFRSrq1StGOM', 'name' => 'Bathory', 'type' => 'artist', 'uri' => 'spotify:artist:6rBvjnvdsRxFRSrq1StGOM', ), ), 'disc_number' => 1, 'duration_ms' => 220200, 'explicit' => false, 'external_ids' => array ( 'isrc' => 'SEXHQ8800404', ), 'external_urls' => array ( 'spotify' => 'https://open.spotify.com/track/0i6joqNGcGa73MXEi1qVJi', ), 'href' => 'https://api.spotify.com/v1/tracks/0i6joqNGcGa73MXEi1qVJi', 'id' => '0i6joqNGcGa73MXEi1qVJi', 'is_playable' => true, 'name' => 'Pace Till Death', 'popularity' => 28, 'preview_url' => 'https://p.scdn.co/mp3-preview/572b24bf4fae0a7ce5ef835b5dc5c60826c4bc79?cid=24974f52d3fc4029a03bee338698b062', 'track_number' => 4, 'type' => 'track', 'uri' => 'spotify:track:0i6joqNGcGa73MXEi1qVJi', ), )


How do I access this part of the current file below



[images] => Array ( [0] => Array ( [height] => 640 [url] => https://i.scdn.co/image/f57171446c8d61050af0e43726c4863dfdc235a4 [width] => 640 ) [1] => Array ( [height] => 300 [url] => https://i.scdn.co/image/4111d12bb7e3a142d12309ba699ce97d78fd8905 


Using PHP how do I display this data above I've tried the below which retrieves the name, however, I want the image as shown above. Note that $result is where I store the results from the API



$result = json_decode(json_encode($result), true);

foreach($result as $obj){

echo "Name : " . $obj['name'];
}









share|improve this question
















This is the data using var_export($result);



 array ( 0 => array ( 'album' => array ( 'album_type' => 'ALBUM', 'artists' => array ( 0 => array ( 'external_urls' => array ( 'spotify' => 'https://open.spotify.com/artist/6rBvjnvdsRxFRSrq1StGOM', ), 'href' => 'https://api.spotify.com/v1/artists/6rBvjnvdsRxFRSrq1StGOM', 'id' => '6rBvjnvdsRxFRSrq1StGOM', 'name' => 'Bathory', 'type' => 'artist', 'uri' => 'spotify:artist:6rBvjnvdsRxFRSrq1StGOM', ), ), 'external_urls' => array ( 'spotify' => 'https://open.spotify.com/album/1ZN0dVt3JGTUJZ5TydY1E8', ), 'href' => 'https://api.spotify.com/v1/albums/1ZN0dVt3JGTUJZ5TydY1E8', 'id' => '1ZN0dVt3JGTUJZ5TydY1E8', 'images' => array ( 0 => array ( 'height' => 640, 'url' => 'https://i.scdn.co/image/ba052dff3d3cf0f5bd9b66a7ac707c2f4dfad065', 'width' => 640, ), 1 => array ( 'height' => 300, 'url' => 'https://i.scdn.co/image/20b02fb5aae2cfe790adb6b65433850a0977542c', 'width' => 300, ), 2 => array ( 'height' => 64, 'url' => 'https://i.scdn.co/image/668e5fb3a1044d4a2d7a90d3491612fe702d558b', 'width' => 64, ), ), 'name' => 'Blood Fire Death', 'type' => 'album', 'uri' => 'spotify:album:1ZN0dVt3JGTUJZ5TydY1E8', ), 'artists' => array ( 0 => array ( 'external_urls' => array ( 'spotify' => 'https://open.spotify.com/artist/6rBvjnvdsRxFRSrq1StGOM', ), 'href' => 'https://api.spotify.com/v1/artists/6rBvjnvdsRxFRSrq1StGOM', 'id' => '6rBvjnvdsRxFRSrq1StGOM', 'name' => 'Bathory', 'type' => 'artist', 'uri' => 'spotify:artist:6rBvjnvdsRxFRSrq1StGOM', ), ), 'disc_number' => 1, 'duration_ms' => 220200, 'explicit' => false, 'external_ids' => array ( 'isrc' => 'SEXHQ8800404', ), 'external_urls' => array ( 'spotify' => 'https://open.spotify.com/track/0i6joqNGcGa73MXEi1qVJi', ), 'href' => 'https://api.spotify.com/v1/tracks/0i6joqNGcGa73MXEi1qVJi', 'id' => '0i6joqNGcGa73MXEi1qVJi', 'is_playable' => true, 'name' => 'Pace Till Death', 'popularity' => 28, 'preview_url' => 'https://p.scdn.co/mp3-preview/572b24bf4fae0a7ce5ef835b5dc5c60826c4bc79?cid=24974f52d3fc4029a03bee338698b062', 'track_number' => 4, 'type' => 'track', 'uri' => 'spotify:track:0i6joqNGcGa73MXEi1qVJi', ), )


How do I access this part of the current file below



[images] => Array ( [0] => Array ( [height] => 640 [url] => https://i.scdn.co/image/f57171446c8d61050af0e43726c4863dfdc235a4 [width] => 640 ) [1] => Array ( [height] => 300 [url] => https://i.scdn.co/image/4111d12bb7e3a142d12309ba699ce97d78fd8905 


Using PHP how do I display this data above I've tried the below which retrieves the name, however, I want the image as shown above. Note that $result is where I store the results from the API



$result = json_decode(json_encode($result), true);

foreach($result as $obj){

echo "Name : " . $obj['name'];
}






php arrays json






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 17 '18 at 11:00







John

















asked Nov 17 '18 at 10:24









JohnJohn

408




408








  • 2





    Isn't this basic array accessing?

    – Jeto
    Nov 17 '18 at 10:28






  • 1





    Can you add to outcome of var_export($result);?

    – The fourth bird
    Nov 17 '18 at 10:29











  • Would this be easier , if I turned it into json format? how may I do this?

    – John
    Nov 17 '18 at 10:32











  • @Thefourthbird the var_export($result) is the same as the data above in my question detials

    – John
    Nov 17 '18 at 10:42






  • 1





    @John If you want the 'images' array, try it like this: foreach($result as $obj){ print_r($obj['album']['images']); }

    – The fourth bird
    Nov 17 '18 at 11:03
















  • 2





    Isn't this basic array accessing?

    – Jeto
    Nov 17 '18 at 10:28






  • 1





    Can you add to outcome of var_export($result);?

    – The fourth bird
    Nov 17 '18 at 10:29











  • Would this be easier , if I turned it into json format? how may I do this?

    – John
    Nov 17 '18 at 10:32











  • @Thefourthbird the var_export($result) is the same as the data above in my question detials

    – John
    Nov 17 '18 at 10:42






  • 1





    @John If you want the 'images' array, try it like this: foreach($result as $obj){ print_r($obj['album']['images']); }

    – The fourth bird
    Nov 17 '18 at 11:03










2




2





Isn't this basic array accessing?

– Jeto
Nov 17 '18 at 10:28





Isn't this basic array accessing?

– Jeto
Nov 17 '18 at 10:28




1




1





Can you add to outcome of var_export($result);?

– The fourth bird
Nov 17 '18 at 10:29





Can you add to outcome of var_export($result);?

– The fourth bird
Nov 17 '18 at 10:29













Would this be easier , if I turned it into json format? how may I do this?

– John
Nov 17 '18 at 10:32





Would this be easier , if I turned it into json format? how may I do this?

– John
Nov 17 '18 at 10:32













@Thefourthbird the var_export($result) is the same as the data above in my question detials

– John
Nov 17 '18 at 10:42





@Thefourthbird the var_export($result) is the same as the data above in my question detials

– John
Nov 17 '18 at 10:42




1




1





@John If you want the 'images' array, try it like this: foreach($result as $obj){ print_r($obj['album']['images']); }

– The fourth bird
Nov 17 '18 at 11:03







@John If you want the 'images' array, try it like this: foreach($result as $obj){ print_r($obj['album']['images']); }

– The fourth bird
Nov 17 '18 at 11:03














2 Answers
2






active

oldest

votes


















0














The images array is not located at the ['name'] key, but you can access the data using ['album']['images']:



For example:



foreach ($result as $obj) {
print_r($obj['album']['images']);
echo $obj['album']['images'][0]['url'];
}


Demo






share|improve this answer





















  • 1





    this is correct , apologies again. thanks for the help

    – John
    Nov 17 '18 at 14:31



















0














if I understand it correctly you want access multi dimmed array.
Try like this one to access a field from your $result array:



$result[0]['album']['images'][0]['url']



This would return "https://i.scdn.co/image/ba052dff3d3cf0f5bd9b66a7ac707c2f4dfad065"



$result[0]['album']['images'][1]['url'] ==> "https://i.scdn.co/image/20b02fb5aae2cfe790adb6b65433850a0977542c"



$result[0]['album']['images'][2]['url'] ==> "https://i.scdn.co/image/668e5fb3a1044d4a2d7a90d3491612fe702d558b"






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53350306%2fhow-to-access-data-from-this-array-file-using-php%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The images array is not located at the ['name'] key, but you can access the data using ['album']['images']:



    For example:



    foreach ($result as $obj) {
    print_r($obj['album']['images']);
    echo $obj['album']['images'][0]['url'];
    }


    Demo






    share|improve this answer





















    • 1





      this is correct , apologies again. thanks for the help

      – John
      Nov 17 '18 at 14:31
















    0














    The images array is not located at the ['name'] key, but you can access the data using ['album']['images']:



    For example:



    foreach ($result as $obj) {
    print_r($obj['album']['images']);
    echo $obj['album']['images'][0]['url'];
    }


    Demo






    share|improve this answer





















    • 1





      this is correct , apologies again. thanks for the help

      – John
      Nov 17 '18 at 14:31














    0












    0








    0







    The images array is not located at the ['name'] key, but you can access the data using ['album']['images']:



    For example:



    foreach ($result as $obj) {
    print_r($obj['album']['images']);
    echo $obj['album']['images'][0]['url'];
    }


    Demo






    share|improve this answer















    The images array is not located at the ['name'] key, but you can access the data using ['album']['images']:



    For example:



    foreach ($result as $obj) {
    print_r($obj['album']['images']);
    echo $obj['album']['images'][0]['url'];
    }


    Demo







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 17 '18 at 11:56

























    answered Nov 17 '18 at 11:09









    The fourth birdThe fourth bird

    21.4k81427




    21.4k81427








    • 1





      this is correct , apologies again. thanks for the help

      – John
      Nov 17 '18 at 14:31














    • 1





      this is correct , apologies again. thanks for the help

      – John
      Nov 17 '18 at 14:31








    1




    1





    this is correct , apologies again. thanks for the help

    – John
    Nov 17 '18 at 14:31





    this is correct , apologies again. thanks for the help

    – John
    Nov 17 '18 at 14:31













    0














    if I understand it correctly you want access multi dimmed array.
    Try like this one to access a field from your $result array:



    $result[0]['album']['images'][0]['url']



    This would return "https://i.scdn.co/image/ba052dff3d3cf0f5bd9b66a7ac707c2f4dfad065"



    $result[0]['album']['images'][1]['url'] ==> "https://i.scdn.co/image/20b02fb5aae2cfe790adb6b65433850a0977542c"



    $result[0]['album']['images'][2]['url'] ==> "https://i.scdn.co/image/668e5fb3a1044d4a2d7a90d3491612fe702d558b"






    share|improve this answer






























      0














      if I understand it correctly you want access multi dimmed array.
      Try like this one to access a field from your $result array:



      $result[0]['album']['images'][0]['url']



      This would return "https://i.scdn.co/image/ba052dff3d3cf0f5bd9b66a7ac707c2f4dfad065"



      $result[0]['album']['images'][1]['url'] ==> "https://i.scdn.co/image/20b02fb5aae2cfe790adb6b65433850a0977542c"



      $result[0]['album']['images'][2]['url'] ==> "https://i.scdn.co/image/668e5fb3a1044d4a2d7a90d3491612fe702d558b"






      share|improve this answer




























        0












        0








        0







        if I understand it correctly you want access multi dimmed array.
        Try like this one to access a field from your $result array:



        $result[0]['album']['images'][0]['url']



        This would return "https://i.scdn.co/image/ba052dff3d3cf0f5bd9b66a7ac707c2f4dfad065"



        $result[0]['album']['images'][1]['url'] ==> "https://i.scdn.co/image/20b02fb5aae2cfe790adb6b65433850a0977542c"



        $result[0]['album']['images'][2]['url'] ==> "https://i.scdn.co/image/668e5fb3a1044d4a2d7a90d3491612fe702d558b"






        share|improve this answer















        if I understand it correctly you want access multi dimmed array.
        Try like this one to access a field from your $result array:



        $result[0]['album']['images'][0]['url']



        This would return "https://i.scdn.co/image/ba052dff3d3cf0f5bd9b66a7ac707c2f4dfad065"



        $result[0]['album']['images'][1]['url'] ==> "https://i.scdn.co/image/20b02fb5aae2cfe790adb6b65433850a0977542c"



        $result[0]['album']['images'][2]['url'] ==> "https://i.scdn.co/image/668e5fb3a1044d4a2d7a90d3491612fe702d558b"







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 10 '18 at 7:54

























        answered Nov 17 '18 at 11:17









        macmurimacmuri

        644




        644






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53350306%2fhow-to-access-data-from-this-array-file-using-php%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Guess what letter conforming each word

            Port of Spain

            Run scheduled task as local user group (not BUILTIN)