3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Orig {} class Override1 {} class Override2 {} class Override3 {} class A { function g () { global $prop, $instance; $newProp = ['override1']; $newInstance = new Override1; $prop=$newProp; $instance=$newInstance; } function ap ($prop, $instance) { $newProp = ['override2']; $newInstance = new Override2; $prop=$newProp; $instance=$newInstance; } function al (&$prop, &$instance) { $newProp = ['override3']; $newInstance = new Override3; $prop=$newProp; $instance=$newInstance; } } $prop = ['orig']; $instance = new Orig; var_dump('Orig:', $prop[0], get_class($instance), '------'); $prop = ['orig']; $instance = new Orig; (new A)->g(); var_dump('As global:', $prop[0], get_class($instance), '------'); $prop = ['orig']; $instance = new Orig; (new A)->ap($prop, $instance); var_dump('As arg:', $prop[0], get_class($instance), '------'); $prop = ['orig']; $instance = new Orig; (new A)->al($prop, $instance); var_dump('As link arg:', $prop[0], get_class($instance), '------');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MpY9D
function name:  (null)
number of ops:  65
compiled vars:  !0 = $prop, !1 = $instance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   ASSIGN                                                   !0, <array>
   39     1        NEW                                              $3      'Orig'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $3
   40     4        INIT_FCALL                                               'var_dump'
          5        SEND_VAL                                                 'Orig%3A'
          6        FETCH_DIM_R                                      ~6      !0, 0
          7        SEND_VAL                                                 ~6
          8        GET_CLASS                                        ~7      !1
          9        SEND_VAL                                                 ~7
         10        SEND_VAL                                                 '------'
         11        DO_ICALL                                                 
   44    12        ASSIGN                                                   !0, <array>
   45    13        NEW                                              $10     'Orig'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !1, $10
   46    16        NEW                                              $13     'A'
         17        DO_FCALL                                      0          
         18        INIT_METHOD_CALL                                         $13, 'g'
         19        DO_FCALL                                      0          
   47    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAL                                                 'As+global%3A'
         22        FETCH_DIM_R                                      ~16     !0, 0
         23        SEND_VAL                                                 ~16
         24        GET_CLASS                                        ~17     !1
         25        SEND_VAL                                                 ~17
         26        SEND_VAL                                                 '------'
         27        DO_ICALL                                                 
   50    28        ASSIGN                                                   !0, <array>
   51    29        NEW                                              $20     'Orig'
         30        DO_FCALL                                      0          
         31        ASSIGN                                                   !1, $20
   52    32        NEW                                              $23     'A'
         33        DO_FCALL                                      0          
         34        INIT_METHOD_CALL                                         $23, 'ap'
         35        SEND_VAR_EX                                              !0
         36        SEND_VAR_EX                                              !1
         37        DO_FCALL                                      0          
   53    38        INIT_FCALL                                               'var_dump'
         39        SEND_VAL                                                 'As+arg%3A'
         40        FETCH_DIM_R                                      ~26     !0, 0
         41        SEND_VAL                                                 ~26
         42        GET_CLASS                                        ~27     !1
         43        SEND_VAL                                                 ~27
         44        SEND_VAL                                                 '------'
         45        DO_ICALL                                                 
   56    46        ASSIGN                                                   !0, <array>
   57    47        NEW                                              $30     'Orig'
         48        DO_FCALL                                      0          
         49        ASSIGN                                                   !1, $30
   58    50        NEW                                              $33     'A'
         51        DO_FCALL                                      0          
         52        INIT_METHOD_CALL                                         $33, 'al'
         53        SEND_VAR_EX                                              !0
         54        SEND_VAR_EX                                              !1
         55        DO_FCALL                                      0          
   59    56        INIT_FCALL                                               'var_dump'
         57        SEND_VAL                                                 'As+link+arg%3A'
         58        FETCH_DIM_R                                      ~36     !0, 0
         59        SEND_VAL                                                 ~36
         60        GET_CLASS                                        ~37     !1
         61        SEND_VAL                                                 ~37
         62        SEND_VAL                                                 '------'
         63        DO_ICALL                                                 
         64      > RETURN                                                   1

Class Orig: [no user functions]
Class Override1: [no user functions]
Class Override2: [no user functions]
Class Override3: [no user functions]
Class A:
Function g:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MpY9D
function name:  g
number of ops:  9
compiled vars:  !0 = $prop, !1 = $instance, !2 = $newProp, !3 = $newInstance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   BIND_GLOBAL                                              !0, 'prop'
          1        BIND_GLOBAL                                              !1, 'instance'
   11     2        ASSIGN                                                   !2, <array>
   12     3        NEW                                              $5      'Override1'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !3, $5
   14     6        ASSIGN                                                   !0, !2
   15     7        ASSIGN                                                   !1, !3
   16     8      > RETURN                                                   null

End of function g

Function ap:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MpY9D
function name:  ap
number of ops:  9
compiled vars:  !0 = $prop, !1 = $instance, !2 = $newProp, !3 = $newInstance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   20     2        ASSIGN                                                   !2, <array>
   21     3        NEW                                              $5      'Override2'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !3, $5
   23     6        ASSIGN                                                   !0, !2
   24     7        ASSIGN                                                   !1, !3
   25     8      > RETURN                                                   null

End of function ap

Function al:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MpY9D
function name:  al
number of ops:  9
compiled vars:  !0 = $prop, !1 = $instance, !2 = $newProp, !3 = $newInstance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   29     2        ASSIGN                                                   !2, <array>
   30     3        NEW                                              $5      'Override3'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !3, $5
   32     6        ASSIGN                                                   !0, !2
   33     7        ASSIGN                                                   !1, !3
   34     8      > RETURN                                                   null

End of function al

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.78 ms | 1460 KiB | 14 Q