robgood Posted December 4, 2007 Share Posted December 4, 2007 Getting un-serialised PHP from a API use http GET $timetotals = file_get_contents($timetotals); the results when print_r($timetotals) gives... Array ( [0] => Array ( [value] => 5880 ) ) I am trying to extract the number 5880 into a variable $value have tried lots of things including below...but can't seem to get it work foreach($timetotals as $key =>$array) { foreach($array as $secondkey=>$value) { echo "<p>$value</p>"; } } Any help would be appreciated Link to comment https://forums.phpfreaks.com/topic/80107-solved-extracting-data-from-multidimensional-associative-array/ Share on other sites More sharing options...
robgood Posted December 4, 2007 Author Share Posted December 4, 2007 Solved, basically the i was getting un-serialized data from the api which i presumed was an array. I got the serialized resource instead and did following $timetotals = unserialize(trim($timetotals)); Link to comment https://forums.phpfreaks.com/topic/80107-solved-extracting-data-from-multidimensional-associative-array/#findComment-405995 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.