3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Orig {}; class Override {}; $instance = new Orig; function test() { global $instance; $newInstance = new Override; $instance=$newInstance; check(); } function check() { global $instance; var_dump($instance); } test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hjYJo
function name:  (null)
number of ops:  6
compiled vars:  !0 = $instance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                                              $1      'Orig'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   17     3        INIT_FCALL                                               'test'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hjYJo
function name:  test
number of ops:  8
compiled vars:  !0 = $instance, !1 = $newInstance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   BIND_GLOBAL                                              !0, 'instance'
    8     1        NEW                                              $2      'Override'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $2
    9     4        ASSIGN                                                   !0, !1
   10     5        INIT_FCALL_BY_NAME                                       'check'
          6        DO_FCALL                                      0          
   11     7      > RETURN                                                   null

End of function test

Function check:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hjYJo
function name:  check
number of ops:  5
compiled vars:  !0 = $instance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   BIND_GLOBAL                                              !0, 'instance'
   14     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   15     4      > RETURN                                                   null

End of function check

Class Orig: [no user functions]
Class Override: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.34 ms | 1402 KiB | 16 Q