3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "status" : "success", "data" : { "items" : [ { "market_hash_name" : "AK-47 | Redline (Field-Tested)", "total_items" : 923, "lowest_price" : "4.00", "highest_price" : "300.00", "cumulative_price" : "8722.77", "recent_sales_info" : { "hours" : "18.07", "average_price" : "4.21" } }, { "market_hash_name" : "AK-47 | Redline (Minimal Wear)", "total_items" : 51, "lowest_price" : "14.26", "highest_price" : "100.00", "cumulative_price" : "1089.71", "recent_sales_info" : { "hours" : "23.37", "average_price" : "14.36" } } ] } }'; $result = json_decode ($json); foreach($result->data->items as $val){ if($val->market_hash_name == "AK-47 | Redline (Field-Tested)") echo "Total Item: ".$val->total_items." AND Avg Price:".$val->recent_sales_info->average_price; }

preferences:
24.06 ms | 404 KiB | 5 Q