3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [0,1,2,3,4,[10,20,30]]; $nu_array = null; $callback = function ( $item ) use(&$callback, &$nu_array) { if (!is_array($item)) { $nu_array[] = $item; } else if ( is_array( $item ) ) { foreach( array_values($item) as $v) { if ( !(is_array($v))) { $nu_array[] = $v; } else { $callback( $v ); continue; } } } }; array_walk($a, $callback); print_r($nu_array); $b = []; array_walk_recursive($a, function ( $item ) use(&$b ) { $b[] = $item; } ); print_r($b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O0BmK
function name:  (null)
number of ops:  24
compiled vars:  !0 = $a, !1 = $nu_array, !2 = $callback, !3 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, null
    4     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FO0BmK%3A4%240'
          3        BIND_LEXICAL                                             ~6, !2
          4        BIND_LEXICAL                                             ~6, !1
          5        ASSIGN                                                   !2, ~6
   23     6        INIT_FCALL                                               'array_walk'
          7        SEND_REF                                                 !0
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                                 
   24    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
   27    13        ASSIGN                                                   !3, <array>
   28    14        INIT_FCALL                                               'array_walk_recursive'
         15        SEND_REF                                                 !0
         16        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FO0BmK%3A28%241'
         17        BIND_LEXICAL                                             ~11, !3
   31    18        SEND_VAL                                                 ~11
         19        DO_ICALL                                                 
   33    20        INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FO0BmK%3A4%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 28
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 27
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 27
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 22
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
Branch analysis from position: 28
filename:       /in/O0BmK
function name:  {closure}
number of ops:  29
compiled vars:  !0 = $item, !1 = $callback, !2 = $nu_array, !3 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
    5     3        TYPE_CHECK                                  128  ~4      !0
          4        BOOL_NOT                                         ~5      ~4
          5      > JMPZ                                                     ~5, ->9
    6     6    >   ASSIGN_DIM                                               !2
          7        OP_DATA                                                  !0
          8      > JMP                                                      ->28
    9     9    >   TYPE_CHECK                                  128          !0
         10      > JMPZ                                                     ~7, ->28
   10    11    >   INIT_FCALL                                               'array_values'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $8      
         14      > FE_RESET_R                                       $9      $8, ->27
         15    > > FE_FETCH_R                                               $9, !3, ->27
   11    16    >   TYPE_CHECK                                  128  ~10     !3
         17        BOOL_NOT                                         ~11     ~10
         18      > JMPZ                                                     ~11, ->22
   12    19    >   ASSIGN_DIM                                               !2
         20        OP_DATA                                                  !3
         21      > JMP                                                      ->26
   16    22    >   INIT_DYNAMIC_CALL                                        !1
         23        SEND_VAR_EX                                              !3
         24        DO_FCALL                                      0          
   17    25      > JMP                                                      ->15
   10    26    > > JMP                                                      ->15
         27    >   FE_FREE                                                  $9
   21    28    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FO0BmK%3A4%240

Function %00%7Bclosure%7D%2Fin%2FO0BmK%3A28%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O0BmK
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $item, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   30     2        ASSIGN_DIM                                               !1
          3        OP_DATA                                                  !0
   31     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FO0BmK%3A28%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.23 ms | 1400 KiB | 21 Q