dictionarydefine Posted October 16, 2015 Share Posted October 16, 2015 I have the following data stored in an array $example. I need to echo or print the fileUrl as seen in this array. I've tried print $example->fileUrl; / and echo $example['fileUrl']; but they don't return anything. Could someone please tell me how to extract fileUrl from this? Array ( [0] => AudioFile Object ( [attributionUrl] => [commentCount] => 0 [voteCount] => [fileUrl] => http://api.wordnik.com/v4/audioFile.mp3/f450d7100e261f09de07e8c2bfba727613189511ce3d7b7ef208bf83670e6974 [audioType] => pronunciation [id] => 9904 [duration] => 0.78 [attributionText] => from The American Heritage® Dictionary of the English Language, 4th Edition [createdBy] => ahd [description] => [createdAt] => DateTime Object ( [date] => 2009-03-15 15:32:01.000000 [timezone_type] => 1 [timezone] => +00:00 ) [voteWeightedAverage] => [voteAverage] => [word] => cat ) [1] => AudioFile Object ( [attributionUrl] => http://www.macmillandictionary.com/dictionary/american/cat [commentCount] => 0 [voteCount] => [fileUrl] => http://api.wordnik.com/v4/audioFile.mp3/e4cb509de86748e409cedeee8965ba83d13d4c480d2086a2f1a05b3d04bb6b24 [audioType] => pronunciation [id] => 209579 [duration] => 1.07 [attributionText] => definition of cat from Macmillan Dictionary -- free online dictionary and thesaurus [createdBy] => macmillan [description] => see more at http://www.macmillandictionary.com/dictionary/american/cat [createdAt] => DateTime Object ( [date] => 2011-04-10 05:57:30.538000 [timezone_type] => 1 [timezone] => +00:00 ) [voteWeightedAverage] => [voteAverage] => [word] => cat ) Quote Link to comment Share on other sites More sharing options...
Solution Barand Posted October 16, 2015 Solution Share Posted October 16, 2015 try foreach ($example as $obj) { echo $obj->fileUrl . '<br/>'; } Quote Link to comment Share on other sites More sharing options...
dictionarydefine Posted October 16, 2015 Author Share Posted October 16, 2015 That worked, thank you. Quote Link to comment 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.