3v4l.org

run code in 300+ PHP versions simultaneously
<?php /*namespace MyProject; use blah\blah as mine; // see "Using namespaces: importing/aliasing" blah\mine(); // calls function MyProject\blah\mine() namespace\blah\mine(); // calls function MyProject\blah\mine() namespace\func(); // calls function MyProject\func() namespace\sub\func(); // calls function MyProject\sub\func() namespace\cname::method(); // calls static method "method" of class MyProject\cname $a = new namespace\sub\cname(); // instantiates object of class MyProject\sub\cname $b = namespace\CONSTANT; // assigns value of constant MyProject\CONSTANT to $b ?>*/ namespace MyProject; function get($classname) { echo $a = __NAMESPACE__ . '\\' . $classname; return new $a; } class asdf {} get('asdF');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/piWbL
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_NS_FCALL_BY_NAME                                    'MyProject%5Cget'
          1        SEND_VAL_EX                                              'asdF'
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

Function myproject%5Cget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/piWbL
function name:  MyProject\get
number of ops:  9
compiled vars:  !0 = $classname, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   21     1        CONCAT                                           ~2      'MyProject%5C', !0
          2        ASSIGN                                           ~3      !1, ~2
          3        ECHO                                                     ~3
   22     4        FETCH_CLASS                                   0  $4      !1
          5        NEW                                              $5      $4
          6        DO_FCALL                                      0          
          7      > RETURN                                                   $5
   23     8*     > RETURN                                                   null

End of function myproject%5Cget

Class MyProject\asdf: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.62 ms | 1397 KiB | 14 Q