Boxerman Posted March 10, 2017 Share Posted March 10, 2017 Hey guys, Sorry to annoy you all with something so simple, but its truly causing hair to fall out (I'm running out as well!) The script below is the core of what im running, however, in the example below you can see array inside array, i've tried everything such as: $feed_to_array['entry'][0]['title]; This is literally confusing me intensely, all i want to do is grab title and content, that is all! Why am i so stupid! Thanks in advance all! <?php error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); $feed = 'http://**deleting**?format=xml'; $feed_to_array = (array) simplexml_load_file($feed); //$feed_to_array = (array) new SimpleXmlElement( file_get_contents($feed) ); echo '<pre>'; print_r($feed_to_array); echo '</pre>'; ?> Output: Array ( [id] => tag:,2017:blog [title] => **removingURL** [link] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [href] => https://www.**removingURL**.com/?mode=atom ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [rel] => license [type] => text/html [href] => http://creativecommons.org/licenses/by/2.0/ ) ) ) [icon] => http://bulk2.**removingURL**.com/ele2/images/**removingURL**/favicon.ico [updated] => 2017-03-09T20:30:00Z [logo] => http://creativecommons.org/images/public/somerights20.gif [entry] => Array ( [0] => SimpleXMLElement Object ( [id] => tag:https://www.**removingURL**.com/,2017:/post.phtml?pk=423974 [author] => SimpleXMLElement Object ( [name] => CJ Andriessen [uri] => http://www.****.com/blogs/CJ+Andriessen ) [title] => Nep nep nep nep nep nep nep this winter [link] => SimpleXMLElement Object ( [@attributes] => Array ( [href] => http://feedproxy.google.com/~r/**removingURL**/~3/sPJh-Cxxbeg/nep-nep-nep-nep-nep-nep-nep-this-winter-423974.phtml ) ) [published] => 2017-03-09T20:30:00Z [updated] => 2017-03-09T20:30:00Z [content] => It has been several months since the last game in the Neptunia franchise hit western shores and something about that is just wrong. Usually, we’re drowning in releases, but it’s been barren since October’s crossover with the Sega Hard Girls franchise. Luckily, hope is on the horizon. Idea Factory International announced today Cyberdimension Neptunia: 4 Goddesses Online will release in North American and in the EU this winter. Coming to PS4 and Steam, Cyberdimension Neptunia features Neptune, Vert, Blanc, Noire and more teaming up to defeat the Demon King in the game-within-a-game known as 4 Goddesses Online. The title will feature 4 player co-op and online play. After watching the trailer below, I call dibs on my bae Nepgear. Nep nep nep nep nep nep nep this winter screenshot Read more... ) Quote Link to comment https://forums.phpfreaks.com/topic/303415-pull-from-array-inside-array/ Share on other sites More sharing options...
NotionCommotion Posted March 10, 2017 Share Posted March 10, 2017 Your missing quote at the end of title, but that isn't the only problem. Arrays are accessed as you did so, but objects use -> instead. $feed_to_array['entry'][0]->title; Quote Link to comment https://forums.phpfreaks.com/topic/303415-pull-from-array-inside-array/#findComment-1544021 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.