3v4l.org

run code in 300+ PHP versions simultaneously
<?php $market_hash_name = 'AK-47 | Aquamarine Revenge (Battle-Scarred)'; $json = '{ "status" : "success", "prices" : [ { "market_hash_name" : "AK-47 | Aquamarine Revenge (Battle-Scarred)", "price" : "15", "created_at" : 1460708937 }, { "market_hash_name" : "AK-47 | Aquamarine Revenge (Factory New)", "price" : "41.4", "created_at" : 1460708934 } ] }'; $arr = json_decode($json, true); foreach($arr['prices'] as $key => $val){ if($val['market_hash_name'] == $market_hash_name){ echo $val['price']; } }

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
154.18 ms | 2694 KiB | 11 Q