3v4l.org

run code in 300+ PHP versions simultaneously
<?php $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 = array('alpha',array(1,2,3),'beta',array(7,8,array(9,10))); array_walk_recursive($array, $callback); print_r($nu_array); $output = array(); array_walk_recursive($array, function ($current) use (&$output) { $output[] = $current; }); print_r($output); print "\n...................................\n"; $output = array(); array_walk($array, function ($current) use (&$output) { $output[] = $current; }); print_r($output);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eeVFD
function name:  (null)
number of ops:  35
compiled vars:  !0 = $nu_array, !1 = $callback, !2 = $array, !3 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, null
    3     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FeeVFD%3A3%240'
          2        BIND_LEXICAL                                             ~5, !1
          3        BIND_LEXICAL                                             ~5, !0
          4        ASSIGN                                                   !1, ~5
   21     5        ASSIGN                                                   !2, <array>
   22     6        INIT_FCALL                                               'array_walk_recursive'
          7        SEND_REF                                                 !2
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
   23    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
   25    13        ASSIGN                                                   !3, <array>
   26    14        INIT_FCALL                                               'array_walk_recursive'
         15        SEND_REF                                                 !2
         16        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FeeVFD%3A26%241'
         17        BIND_LEXICAL                                             ~11, !3
   28    18        SEND_VAL                                                 ~11
         19        DO_ICALL                                                 
   29    20        INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                                 
   30    23        ECHO                                                     '%0A...................................%0A'
   31    24        ASSIGN                                                   !3, <array>
   32    25        INIT_FCALL                                               'array_walk'
         26        SEND_REF                                                 !2
         27        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FeeVFD%3A32%242'
         28        BIND_LEXICAL                                             ~15, !3
   34    29        SEND_VAL                                                 ~15
         30        DO_ICALL                                                 
   35    31        INIT_FCALL                                               'print_r'
         32        SEND_VAR                                                 !3
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FeeVFD%3A3%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/eeVFD
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
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
    4     3        TYPE_CHECK                                  128  ~4      !0
          4        BOOL_NOT                                         ~5      ~4
          5      > JMPZ                                                     ~5, ->9
    5     6    >   ASSIGN_DIM                                               !2
          7        OP_DATA                                                  !0
          8      > JMP                                                      ->28
    8     9    >   TYPE_CHECK                                  128          !0
         10      > JMPZ                                                     ~7, ->28
    9    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
   10    16    >   TYPE_CHECK                                  128  ~10     !3
         17        BOOL_NOT                                         ~11     ~10
         18      > JMPZ                                                     ~11, ->22
   11    19    >   ASSIGN_DIM                                               !2
         20        OP_DATA                                                  !3
         21      > JMP                                                      ->26
   15    22    >   INIT_DYNAMIC_CALL                                        !1
         23        SEND_VAR_EX                                              !3
         24        DO_FCALL                                      0          
   16    25      > JMP                                                      ->15
    9    26    > > JMP                                                      ->15
         27    >   FE_FREE                                                  $9
   20    28    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FeeVFD%3A3%240

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

End of function %00%7Bclosure%7D%2Fin%2FeeVFD%3A26%241

Function %00%7Bclosure%7D%2Fin%2FeeVFD%3A32%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eeVFD
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $current, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   33     2        ASSIGN_DIM                                               !1
          3        OP_DATA                                                  !0
   34     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FeeVFD%3A32%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.22 ms | 1404 KiB | 21 Q