3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace test\foo; class Bar { public static function className() { $class = self; return (new \ReflectionClass($class))->getShortName(); } } echo \test\foo\Bar::className(), PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QGbjE
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_STATIC_METHOD_CALL                                  'test%5Cfoo%5CBar', 'className'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3        FETCH_CONSTANT                                   ~1      'test%5Cfoo%5CPHP_EOL'
          4        ECHO                                                     ~1
          5      > RETURN                                                   1

Class test\foo\Bar:
Function classname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QGbjE
function name:  className
number of ops:  9
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_CONSTANT                                   ~1      'test%5Cfoo%5Cself'
          1        ASSIGN                                                   !0, ~1
    6     2        NEW                                              $3      'ReflectionClass'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        INIT_METHOD_CALL                                         $3, 'getShortName'
          6        DO_FCALL                                      0  $5      
          7      > RETURN                                                   $5
    7     8*     > RETURN                                                   null

End of function classname

End of class test\foo\Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.86 ms | 1393 KiB | 13 Q