3v4l.org

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

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

End of function monkeys

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.6 ms | 1403 KiB | 16 Q