3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TestClass { use TestTrait; } trait TestTrait { public function getSelf(): self { echo __CLASS__ . PHP_EOL; echo static::class . PHP_EOL; echo self::class . PHP_EOL; return $this; } } $test = new TestClass; var_dump($test->getSelf());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HI8hb
function name:  (null)
number of ops:  10
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'testclass'
   17     1        NEW                                              $1      'TestClass'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   18     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'getSelf'
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Class TestClass: [no user functions]
Class TestTrait:
Function getself:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HI8hb
function name:  getSelf
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_CLASS_NAME                                 ~0      
          1        CONCAT                                           ~1      ~0, '%0A'
          2        ECHO                                                     ~1
   10     3        FETCH_CLASS_NAME                                 ~2      
          4        CONCAT                                           ~3      ~2, '%0A'
          5        ECHO                                                     ~3
   11     6        FETCH_CLASS_NAME                                 ~4      
          7        CONCAT                                           ~5      ~4, '%0A'
          8        ECHO                                                     ~5
   13     9        FETCH_THIS                                       ~6      
         10        VERIFY_RETURN_TYPE                                       ~6
         11      > RETURN                                                   ~6
   14    12*       VERIFY_RETURN_TYPE                                       
         13*     > RETURN                                                   null

End of function getself

End of class TestTrait.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
124.69 ms | 1010 KiB | 14 Q