A
Anonymous
Guest
https://www.testdome.com/for-developers/solve-question/11840 I can`t complete this easy test
.
I can`t figure out how to complete this one. I went so below so far.
<?php
class FileOwners
{
public static function groupByOwners($files)
{
$grouped = array();
foreach ($files as $value => $key){
$grouped[$key][$value] = $key;
//print "$key = $val\n";
}
return $grouped;
}
}
$files = array
(
"Input.txt" => "Randy",
"Code.py" => "Stan",
"Output.txt" => "Randy"
);
var_dump(FileOwners::groupByOwners($files));
?>
Can anyone show me how to do it? Thanks!

I can`t figure out how to complete this one. I went so below so far.
<?php
class FileOwners
{
public static function groupByOwners($files)
{
$grouped = array();
foreach ($files as $value => $key){
$grouped[$key][$value] = $key;
//print "$key = $val\n";
}
return $grouped;
}
}
$files = array
(
"Input.txt" => "Randy",
"Code.py" => "Stan",
"Output.txt" => "Randy"
);
var_dump(FileOwners::groupByOwners($files));
?>
Can anyone show me how to do it? Thanks!