3v4l.org

run code in 300+ PHP versions simultaneously
<?php $nu_array = null; $callback = function ( $item ) use(&$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( 'a',array(1,2), 'b',array(3,4, array(5,6, array('c', array(7,8)))) ); array_walk($array, $callback); print_r($nu_array); /** Array ( [0] => a [1] => 1 [2] => 2 [3] => b [4] => 3 [5] => 4 [6] => 5 [7] => 6 [8] => c [9] => 7 [10] => 8 ) **/
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l26Xg
function name:  (null)
number of ops:  13
compiled vars:  !0 = $nu_array, !1 = $callback, !2 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, null
    3     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fl26Xg%3A3%240'
          2        BIND_LEXICAL                                             ~4, !0
          3        ASSIGN                                                   !1, ~4
   21     4        ASSIGN                                                   !2, <array>
   24     5        INIT_FCALL                                               'array_walk'
          6        SEND_REF                                                 !2
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
   25     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
   41    12      > RETURN                                                   1

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.41 ms | 1400 KiB | 19 Q