function getNames(array $users, $excludeId) { $filtered = array_filter($users, function ($u) use ($excludeId) { return $u['id'] != $excludeId; }); return array_map(function ($u) { return $u['name']; }, $filtered); }