3v4l.org

run code in 500+ PHP versions simultaneously
<?php function foo(&$var) { $var = 2; } $a = 1; foo($a); var_dump($a); // 2 class A { public function do() { foo($this); var_dump($this); // still the same object } public function doo() { $a = new self(); foo($a); var_dump($a); // 2 } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a5cXC
function name:  (null)
number of ops:  8
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                       !0, 1
    8     1        INIT_FCALL                                                   'foo'
          2        SEND_REF                                                     !0
          3        DO_FCALL                                          0          
    9     4        INIT_FCALL                                                   'var_dump'
          5        SEND_VAR                                                     !0
          6        DO_ICALL                                                     
   22     7      > RETURN                                                       1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a5cXC
function name:  foo
number of ops:  3
compiled vars:  !0 = $var
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1        ASSIGN                                                       !0, 2
    5     2      > RETURN                                                       null

End of function foo

Class A:
Function do:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a5cXC
function name:  do
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                                   'foo'
          1        FETCH_THIS                                           $0      
          2        SEND_REF                                                     $0
          3        DO_FCALL                                          0          
   14     4        INIT_FCALL                                                   'var_dump'
          5        FETCH_THIS                                           ~2      
          6        SEND_VAL                                                     ~2
          7        DO_ICALL                                                     
   15     8      > RETURN                                                       null

End of function do

Function doo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a5cXC
function name:  doo
number of ops:  10
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   NEW                              self                $1      
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   19     3        INIT_FCALL                                                   'foo'
          4        SEND_REF                                                     !0
          5        DO_FCALL                                          0          
   20     6        INIT_FCALL                                                   'var_dump'
          7        SEND_VAR                                                     !0
          8        DO_ICALL                                                     
   21     9      > RETURN                                                       null

End of function doo

End of class A.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.71 ms | 1472 KiB | 17 Q