'%' . $query . '%')); foreach ($users as $u) { $result[] = [ 'id' => $u['id'], 'username' => $u['username'], 'photourl' => $u['photourl'], ]; } echo json_encode($result); } }