3v4l.org

run code in 500+ 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:  7
compiled vars:  !0 = $instance
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                                'override'
    5     1        NEW                                                  $1      'Orig'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   17     4        INIT_FCALL                                                   'test'
          5        DO_FCALL                                          0          
          6      > 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.5.0


preferences:
271.59 ms | 2086 KiB | 16 Q