3v4l.org

run code in 300+ PHP versions simultaneously
<?php ###MISSION IS BELOW IN COMMENT #the groupByOwners function should return ["Randy" => ["Input.txt", "Output.txt"], "Stan" => ["Code.py"]]. class FileOwners { public static function groupByOwners($files) { $result = array(); foreach($files as $name => $owner){ $result[$owner][] = $name; } return $result; } } $files = array ( "Input.txt" => "Randy", "Code.py" => "Stan", "Output.txt" => "Randy" ); var_dump(FileOwners::groupByOwners($files));

preferences:
31.87 ms | 402 KiB | 5 Q