3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array("red"=>"apple","blue"=>"sky","orange"=>"juice"); $output = array(); // or, $output = null; $closure = function($element) use(&$output) { { $output[] = $element; } }; array_walk_recursive($array, $closure); print_r($output); /** Array ( [0] => apple [1] => sky [2] => juice ) **/
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FplQ3
function name:  (null)
number of ops:  13
compiled vars:  !0 = $array, !1 = $output, !2 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
    4     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FFplQ3%3A4%240'
          3        BIND_LEXICAL                                             ~5, !1
          4        ASSIGN                                                   !2, ~5
    9     5        INIT_FCALL                                               'array_walk_recursive'
          6        SEND_REF                                                 !0
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                                 
   10     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   18    12      > RETURN                                                   1

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.62 ms | 1399 KiB | 17 Q