在JSON字符串中获取嵌套数组的最简单方法

$json_string = 'http://pubapi.cryptsy.com/api.php?method=marketdatav2';

$jsondata = file_get_contents($json_string);

I am new in php. Maybe its stupid question. But what is the easiest way to get lastestprice of all markets?

Use json_decode function to convert json string to array & traverse the array accordingly.

 $jsondata = file_get_contents($json_string);
 $array = json_decode($jsondata,true);
 foreach($array['return']['markets'] as $lprice) {
  $latest_price[$lprice['label']] = $lprice['lasttradeprice'];
}
 echo "<pre>";
 print_r($latest_price);
 echo "<pre>";

Try

$decoded = json_decode($jsondata);
$latestprices = array();
foreach($decoded['return']['markets'] as $val) {
    $latestprices[$val['label']] = $val['lasttradeprice'];
}