Skip to content Skip to sidebar Skip to footer

Listing Information From An Array (php)

I have connected to an API via CURL and I get what is below returned to me. I'm a bit lost. But how would I with the help of PHP extract and display information so it looks like:

Solution 1:

You need to json_decode() curl response and apply foreach() to get desired result

$array = json_decode($curl_response,true);
foreach($array['rows'] as$arr){
  echo explode(' ',$arr['timestamp'])[0].'-'.number_format((float)$arr['revenue'], 2, '.', '').' USD'.PHP_EOL;
}

https://3v4l.org/eUavL

Post a Comment for "Listing Information From An Array (php)"