3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 0 => [ 0 => [1,2,3], // +1 1 => [4,5] // +1 ], 1 => [ 0 => [6,7], // +1 1 => [8,9,10] // +1 ] ]; function monkeys($array, $count) { foreach ($array as $sub) { if (! is_array($sub)) { return ++$count; } else { return monkeys($sub, $count); } } } var_dump(monkeys($array,0));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uGCBv
function name:  (null)
number of ops:  9
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   23     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'monkeys'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 0
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function monkeys:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/uGCBv
function name:  monkeys
number of ops:  20
compiled vars:  !0 = $array, !1 = $count, !2 = $sub
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2      > FE_RESET_R                                       $3      !0, ->18
          3    > > FE_FETCH_R                                               $3, !2, ->18
   15     4    >   TYPE_CHECK                                  128  ~4      !2
          5        BOOL_NOT                                         ~5      ~4
          6      > JMPZ                                                     ~5, ->11
   16     7    >   PRE_INC                                          ~6      !1
          8        FE_FREE                                                  $3
          9      > RETURN                                                   ~6
         10*       JMP                                                      ->17
   18    11    >   INIT_FCALL_BY_NAME                                       'monkeys'
         12        SEND_VAR_EX                                              !2
         13        SEND_VAR_EX                                              !1
         14        DO_FCALL                                      0  $7      
         15        FE_FREE                                                  $3
         16      > RETURN                                                   $7
   14    17*       JMP                                                      ->3
         18    >   FE_FREE                                                  $3
   21    19      > RETURN                                                   null

End of function monkeys

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.85 ms | 1399 KiB | 16 Q