3v4l.org

run code in 300+ PHP versions simultaneously
<?php function flatten(array $array) { $return = array(); array_walk_recursive($array, function($a, $b) use (&$return) { $return[$b] = $a; }); return $return; } $a = array(1,2,array(3,4, array(5,6,7), 8), 9); $array = array( 1 => array( 5 => array( 3 => 'testvalue1' ) ), 2 => array( 6 => 'testvalue2' ), 3 => 'testvalue3', 4 => 'testvalue4', ); var_dump(flatten($a));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BaHkM
function name:  (null)
number of ops:  9
compiled vars:  !0 = $a, !1 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, <array>
   26     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'flatten'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function flatten:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BaHkM
function name:  flatten
number of ops:  10
compiled vars:  !0 = $array, !1 = $return
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, <array>
    4     2        INIT_FCALL                                               'array_walk_recursive'
          3        SEND_REF                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FBaHkM%3A4%240'
          5        BIND_LEXICAL                                             ~3, !1
    6     6        SEND_VAL                                                 ~3
          7        DO_ICALL                                                 
    8     8      > RETURN                                                   !1
    9     9*     > RETURN                                                   null

End of function flatten

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.15 ms | 1399 KiB | 18 Q