3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [[1], [2], [3]]; function foo(){ echo 'called'.PHP_EOL; return 1; } foreach ($array as [foo() => &$val]) { var_dump($val); } var_dump($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 13
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/kPQdP
function name:  (null)
number of ops:  18
compiled vars:  !0 = $array, !1 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    8     1      > FE_RESET_RW                                      $3      !0, ->13
          2    > > FE_FETCH_RW                                              $3, $4, ->13
          3    >   INIT_FCALL                                               'foo'
          4        DO_FCALL                                      0  $5      
          5        FETCH_LIST_W                                     $6      $4, $5
          6        MAKE_REF                                         $7      $6
          7        ASSIGN_REF                                               !1, $7
          8        FREE                                                     $4
          9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
         12      > JMP                                                      ->2
         13    >   FE_FREE                                                  $3
   10    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kPQdP
function name:  foo
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'called%0A'
    6     1      > RETURN                                                   1
    7     2*     > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
217.25 ms | 1002 KiB | 15 Q