3v4l.org

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

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

End of function %00%7Bclosure%7D%2Fin%2F3LaNc%3A5%240

Function %00%7Bclosure%7D%2Fin%2F3LaNc%3A28%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3LaNc
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $item, !1 = $nu_array
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%2F3LaNc%3A28%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.19 ms | 1392 KiB | 21 Q