$participantlist = [1 => 'Peter', 2 => 'Henry', 3 => 'Sarah']; $firstnames= []; foreach ($participantlist as $id => $name) { $firstnames[] = $name; }