I'm good with PHP, but my brain is slow working with arrays.
This is an API, returning a JSON I already encoded into an array.
http://data.gate.io/api2/1/tickers
Let's call it $myarray
$index=1;
foreach($myarray as $key => $value)
{
echo $index." ".$value['last']."<BR>";
$index++;
}
Everything works ok, I can access all the fields inside the sub-arrays; but I can not access the "name" of the subarray ("btc_usdt" for example). If I use $value[0], I got a null. If I use $value alone, I got the string "array". Is there any way I can access that info?
$keyas the json array is an array of arrays. my answer is a working example getting the name and value "last"