3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function test( $in ) { foreach ( $in as $k => $v ) { global $$k; $in[$k] = $$k; $$k = $v; } return $in; } } $bar = 'bar'; $baz = 'baz'; $o = new Foo(); $replace = $o->test( array( 'bar' => 'bar1', 'baz' => 'baz1' ) ); var_dump( $bar ); var_dump( $baz ); $o->test( $replace ); var_dump( $bar ); var_dump( $baz );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WHnjj
function name:  (null)
number of ops:  25
compiled vars:  !0 = $bar, !1 = $baz, !2 = $o, !3 = $replace
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, 'bar'
   17     1        ASSIGN                                                   !1, 'baz'
   19     2        NEW                                              $6      'Foo'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !2, $6
   20     5        INIT_METHOD_CALL                                         !2, 'test'
          6        SEND_VAL_EX                                              <array>
          7        DO_FCALL                                      0  $9      
          8        ASSIGN                                                   !3, $9
   22     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
   23    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                                 
   25    15        INIT_METHOD_CALL                                         !2, 'test'
         16        SEND_VAR_EX                                              !3
         17        DO_FCALL                                      0          
   27    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                                 
   28    21        INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Class Foo:
Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 13
Branch analysis from position: 2
2 jumps found. (Code = 78) 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/WHnjj
function name:  test
number of ops:  16
compiled vars:  !0 = $in, !1 = $v, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1      > FE_RESET_R                                       $3      !0, ->13
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->13
          3    >   ASSIGN                                                   !2, ~4
    7     4        FETCH_W                      global lock         $6      !2
          5        FETCH_W                      local               $7      !2
          6        ASSIGN_REF                                               $7, $6
    8     7        FETCH_R                      local               ~9      !2
          8        ASSIGN_DIM                                               !0, !2
          9        OP_DATA                                                  ~9
    9    10        FETCH_W                      local               $10     !2
         11        ASSIGN                                                   $10, !1
    6    12      > JMP                                                      ->2
         13    >   FE_FREE                                                  $3
   11    14      > RETURN                                                   !0
   12    15*     > RETURN                                                   null

End of function test

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.89 ms | 1400 KiB | 15 Q