- var_dump: documentation ( source)
<?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));