Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //answer for https://www.testdome.com/questions/php/file-owners/11840?visibility=17&skillId=5
- class FileOwners
- {
- public static function groupByOwners($files)
- {
- $result=array();
- foreach($files as $key=>$value)
- {
- $result[$value][]=$key;
- }
- return $result;
- }
- }
- $files = array
- (
- "Input.txt" => "Randy",
- "Code.py" => "Stan",
- "Output.txt" => "Randy"
- );
- var_dump(FileOwners::groupByOwners($files));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement