3v4l.org

run code in 300+ PHP versions simultaneously
<?php function takeRef(&$foo) { $foo = "this is a string now"; } class A { private int $data = 42; public function makeString() { takeRef($this->data); var_dump($this->data); } } $a = new A(); $a->makeString();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kl5e2
function name:  (null)
number of ops:  6
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   15     3        INIT_METHOD_CALL                                         !0, 'makeString'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

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

End of function takeref

Class A:
Function makestring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kl5e2
function name:  makeString
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'takeref'
          1        FETCH_OBJ_W                                      $0      'data'
          2        SEND_REF                                                 $0
          3        DO_FCALL                                      0          
   11     4        INIT_FCALL                                               'var_dump'
          5        FETCH_OBJ_R                                      ~2      'data'
          6        SEND_VAL                                                 ~2
          7        DO_ICALL                                                 
   12     8      > RETURN                                                   null

End of function makestring

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.08 ms | 1409 KiB | 16 Q