3v4l.org

run code in 300+ PHP versions simultaneously
<?php $readJson = [ [ 'id' => 78, 'name' => 'audi', 'sscat_id' => 59, 'date' => '0000-00-00 00:00:00' ], [ 'id' => 106, 'name' => 'apache', 'sscat_id' => 86, 'date' => '0000-00-00 00:00:00' ], [ 'id' => 16, 'name' => 'asia', 'sscat_id' => 62, 'date' => '0000-00-00 00:00:00' ] ]; $_GET['b'] = 16; // test case for echoing one //$_GET['b'] = 99; // test case for echoing all $lookup = array_column($readJson, 'name', 'id'); echo $lookup[$_GET["b"]] ?? implode(', ', $lookup);

preferences:
39.34 ms | 405 KiB | 5 Q