3v4l.org

run code in 300+ PHP versions simultaneously
<?php $r= new ReflectionClass(new class() { public function instance(): self { return $this; } }); $type= $r->getMethod('instance')->getReturnType(); var_dump($type->getName()); $o = new ($type->getName()); var_dump($o);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5D2aT
function name:  (null)
number of ops:  28
compiled vars:  !0 = $r, !1 = $type, !2 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $3      'ReflectionClass'
          1        DECLARE_ANON_CLASS                               <true>  
          2        NEW                                              $5      $4
          3        DO_FCALL                                      0          
          4        SEND_VAR_NO_REF_EX                                       $5
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $3
    7     7        INIT_METHOD_CALL                                         !0, 'getMethod'
          8        SEND_VAL_EX                                              'instance'
          9        DO_FCALL                                      0  $9      
         10        INIT_METHOD_CALL                                         $9, 'getReturnType'
         11        DO_FCALL                                      0  $10     
         12        ASSIGN                                                   !1, $10
    8    13        INIT_FCALL                                               'var_dump'
         14        INIT_METHOD_CALL                                         !1, 'getName'
         15        DO_FCALL                                      0  $12     
         16        SEND_VAR                                                 $12
         17        DO_ICALL                                                 
   10    18        INIT_METHOD_CALL                                         !1, 'getName'
         19        DO_FCALL                                      0  $14     
         20        FETCH_CLASS                                   0  $15     $14
         21        NEW                                              $16     $15
         22        DO_FCALL                                      0          
         23        ASSIGN                                                   !2, $16
   11    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Class class@anonymous:
Function instance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5D2aT
function name:  instance
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   FETCH_THIS                                       ~0      
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
          3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function instance

End of class class@anonymous.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.06 ms | 1011 KiB | 14 Q