3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { static public function getNew() { return new static; } } $a = new Test(); $b = new $a(); print_r($b); print_r($a); $c = new $a; var_dump($a !== $b); var_dump($a !== $c);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t1lmQ
function name:  (null)
number of ops:  26
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $3      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   12     3        FETCH_CLASS                                   0  $6      !0
          4        NEW                                              $7      $6
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $7
   13     7        INIT_FCALL                                               'print_r'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
   14    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
   15    13        FETCH_CLASS                                   0  $12     !0
         14        NEW                                              $13     $12
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !2, $13
   16    17        INIT_FCALL                                               'var_dump'
         18        IS_NOT_IDENTICAL                                 ~16     !0, !1
         19        SEND_VAL                                                 ~16
         20        DO_ICALL                                                 
   17    21        INIT_FCALL                                               'var_dump'
         22        IS_NOT_IDENTICAL                                 ~18     !0, !2
         23        SEND_VAL                                                 ~18
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Class Test:
Function getnew:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t1lmQ
function name:  getNew
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                          static              $0      
          1        DO_FCALL                                      0          
          2      > RETURN                                                   $0
    8     3*     > RETURN                                                   null

End of function getnew

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.1 ms | 941 KiB | 18 Q