Skip to content

Instantly share code, notes, and snippets.

@sonichandni
Created August 16, 2022 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sonichandni/308ddd59942a6368860928ddb96c86c2 to your computer and use it in GitHub Desktop.
Save sonichandni/308ddd59942a6368860928ddb96c86c2 to your computer and use it in GitHub Desktop.
<?php
function groupByOwners(array $files) : array {
$data = [];
foreach($files as $key => $val) {
$data[$val][] = $key;
}
return $data;
}
$files = array
(
"Input.txt" => "Randy",
"Code.py" => "Stan",
"Output.txt" => "Randy"
);
var_dump(groupByOwners($files));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment