<?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 $names = []; foreach ($readJson as $row) { if ($row['id'] === $_GET["b"]) { $names = [$row['name']]; break; } $names[] = $row['name']; } echo implode(', ', $names);
You have javascript disabled. You will not be able to edit any code.