3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple"); function test_alter(&$item1, $key, $prefix) { $item1 = "$prefix: $item1"; } function test_print($item2, $key) { echo "$key. $item2<br />\n"; } echo "Before ...:\n"; array_walk($fruits, 'test_print'); // array_walk($fruits, 'test_alter', 'fruit'); echo "... and after:\n"; array_walk($fruits,function($value, $key){$key = $value; $value=false;}); var_dump($fruits);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F9nQa
function name:  (null)
number of ops:  16
compiled vars:  !0 = $fruits
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   15     1        ECHO                                                     'Before+...%3A%0A'
   16     2        INIT_FCALL                                               'array_walk'
          3        SEND_REF                                                 !0
          4        SEND_VAL                                                 'test_print'
          5        DO_ICALL                                                 
   19     6        ECHO                                                     '...+and+after%3A%0A'
   21     7        INIT_FCALL                                               'array_walk'
          8        SEND_REF                                                 !0
          9        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FF9nQa%3A21%240'
         10        SEND_VAL                                                 ~3
         11        DO_ICALL                                                 
   23    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function test_alter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F9nQa
function name:  test_alter
number of ops:  8
compiled vars:  !0 = $item1, !1 = $key, !2 = $prefix
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    7     3        ROPE_INIT                                     3  ~4      !2
          4        ROPE_ADD                                      1  ~4      ~4, '%3A+'
          5        ROPE_END                                      2  ~3      ~4, !0
          6        ASSIGN                                                   !0, ~3
    8     7      > RETURN                                                   null

End of function test_alter

Function test_print:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F9nQa
function name:  test_print
number of ops:  8
compiled vars:  !0 = $item2, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        ROPE_INIT                                     4  ~3      !1
          3        ROPE_ADD                                      1  ~3      ~3, '.+'
          4        ROPE_ADD                                      2  ~3      ~3, !0
          5        ROPE_END                                      3  ~2      ~3, '%3Cbr+%2F%3E%0A'
          6        ECHO                                                     ~2
   13     7      > RETURN                                                   null

End of function test_print

Function %00%7Bclosure%7D%2Fin%2FF9nQa%3A21%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F9nQa
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $value, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        ASSIGN                                                   !1, !0
          3        ASSIGN                                                   !0, <false>
          4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FF9nQa%3A21%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
209.38 ms | 1400 KiB | 17 Q