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));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QJI6C
function name:  (null)
number of ops:  8
compiled vars:  !0 = $files
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, <array>
   24     1        INIT_FCALL                                               'var_dump'
          2        INIT_STATIC_METHOD_CALL                                  'FileOwners', 'groupByOwners'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Class FileOwners:
Function groupbyowners:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/QJI6C
function name:  groupByOwners
number of ops:  12
compiled vars:  !0 = $files, !1 = $result, !2 = $owner, !3 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        ASSIGN                                                   !1, <array>
   11     2      > FE_RESET_R                                       $5      !0, ->9
          3    > > FE_FETCH_R                                       ~6      $5, !2, ->9
          4    >   ASSIGN                                                   !3, ~6
   12     5        FETCH_DIM_W                                      $8      !1, !2
          6        ASSIGN_DIM                                               $8
          7        OP_DATA                                                  !3
   11     8      > JMP                                                      ->3
          9    >   FE_FREE                                                  $5
   14    10      > RETURN                                                   !1
   15    11*     > RETURN                                                   null

End of function groupbyowners

End of class FileOwners.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.51 ms | 1395 KiB | 15 Q