3v4l.org

run code in 300+ PHP versions simultaneously
<?php function rcr(array $ids): array { $array = []; foreach ($ids as $id) { $array[$id] = rcr(getSubIds($id)); } return $array; } function getSubIds(int $id): array { switch ($id) { case 2: return [5, 108]; case 5: return [7]; case 7: return [46]; case 8: return [72]; default: return []; } } print_r(rcr([2, 14, 8]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tjMRa
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL                                               'rcr'
          2        SEND_VAL                                                 <array>
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function rcr:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/tjMRa
function name:  rcr
number of ops:  18
compiled vars:  !0 = $ids, !1 = $array, !2 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, <array>
    6     2      > FE_RESET_R                                       $4      !0, ->13
          3    > > FE_FETCH_R                                               $4, !2, ->13
    7     4    >   INIT_FCALL_BY_NAME                                       'rcr'
          5        INIT_FCALL_BY_NAME                                       'getSubIds'
          6        SEND_VAR_EX                                              !2
          7        DO_FCALL                                      0  $6      
          8        SEND_VAR_NO_REF_EX                                       $6
          9        DO_FCALL                                      0  $7      
         10        ASSIGN_DIM                                               !1, !2
         11        OP_DATA                                                  $7
    6    12      > JMP                                                      ->3
         13    >   FE_FREE                                                  $4
    9    14        VERIFY_RETURN_TYPE                                       !1
         15      > RETURN                                                   !1
   10    16*       VERIFY_RETURN_TYPE                                       
         17*     > RETURN                                                   null

End of function rcr

Function getsubids:
Finding entry points
Branch analysis from position: 0
6 jumps found. (Code = 187) Position 1 = 11, Position 2 = 12, Position 3 = 13, Position 4 = 14, Position 5 = 15, Position 6 = 2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 14
Branch analysis from position: 13
Branch analysis from position: 12
Branch analysis from position: 11
filename:       /in/tjMRa
function name:  getSubIds
number of ops:  18
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1      > SWITCH_LONG                                              !0, [ 2:->11, 5:->12, 7:->13, 8:->14, ], ->15
   15     2    >   IS_EQUAL                                                 !0, 2
          3      > JMPNZ                                                    ~1, ->11
   16     4    >   IS_EQUAL                                                 !0, 5
          5      > JMPNZ                                                    ~1, ->12
   17     6    >   IS_EQUAL                                                 !0, 7
          7      > JMPNZ                                                    ~1, ->13
   18     8    >   IS_EQUAL                                                 !0, 8
          9      > JMPNZ                                                    ~1, ->14
         10    > > JMP                                                      ->15
   15    11    > > RETURN                                                   <array>
   16    12    > > RETURN                                                   <array>
   17    13    > > RETURN                                                   <array>
   18    14    > > RETURN                                                   <array>
   19    15    > > RETURN                                                   <array>
   21    16*       VERIFY_RETURN_TYPE                                       
         17*     > RETURN                                                   null

End of function getsubids

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.11 ms | 1407 KiB | 16 Q