3v4l.org

run code in 300+ PHP versions simultaneously
<?php class B { } class A { public function M() { echo("this=" . get_class($this) . "\n"); $x = "this"; $$x = new B(); echo("this=" . get_class($this) . "\n"); } } $a = new A(); $a->M();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TdZJt
function name:  (null)
number of ops:  6
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        INIT_METHOD_CALL                                         !0, 'M'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class B: [no user functions]
Class A:
Function m:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TdZJt
function name:  M
number of ops:  16
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_THIS                                       ~1      
          1        GET_CLASS                                        ~2      ~1
          2        CONCAT                                           ~3      'this%3D', ~2
          3        CONCAT                                           ~4      ~3, '%0A'
          4        ECHO                                                     ~4
   11     5        ASSIGN                                                   !0, 'this'
   12     6        NEW                                              $7      'B'
          7        DO_FCALL                                      0          
          8        FETCH_W                      local               $6      !0
          9        ASSIGN                                                   $6, $7
   13    10        FETCH_THIS                                       ~10     
         11        GET_CLASS                                        ~11     ~10
         12        CONCAT                                           ~12     'this%3D', ~11
         13        CONCAT                                           ~13     ~12, '%0A'
         14        ECHO                                                     ~13
   14    15      > RETURN                                                   null

End of function m

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
275.53 ms | 1398 KiB | 14 Q