3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace A; use B\D, C\E as F; // function calls function foo() { echo __NAMESPACE__;} // function calls foo(); // first tries to call "foo" defined in namespace "A" // then calls global function "foo" my\foo(); // calls function "foo" defined in namespace "A\my" F(); // first tries to call "F" defined in namespace "A" // then calls global function "F" // class references new B(); // creates object of class "B" defined in namespace "A" // if not found, it tries to autoload class "A\B" new D(); // using import rules, creates object of class "D" defined in namespace "B" // if not found, it tries to autoload class "B\D" new F(); // using import rules, creates object of class "E" defined in namespace "C" // if not found, it tries to autoload class "C\E" new \B(); // creates object of class "B" defined in global scope // if not found, it tries to autoload class "B" new \D(); // creates object of class "D" defined in global scope // if not found, it tries to autoload class "D" new \F(); // creates object of class "F" defined in global scope // if not found, it tries to autoload class "F" // static methods/namespace functions from another namespace B\foo(); // calls function "foo" from namespace "A\B" B::foo(); // calls method "foo" of class "B" defined in namespace "A" // if class "A\B" not found, it tries to autoload class "A\B" D::foo(); // using import rules, calls method "foo" of class "D" defined in namespace "B" // if class "B\D" not found, it tries to autoload class "B\D" \B\foo(); // calls function "foo" from namespace "B" \B::foo(); // calls method "foo" of class "B" from global scope // if class "B" not found, it tries to autoload class "B" // static methods/namespace functions of current namespace A\B::foo(); // calls method "foo" of class "B" from namespace "A\A" // if class "A\A\B" not found, it tries to autoload class "A\A\B" \A\B::foo(); // calls method "foo" of class "B" from namespace "A" // if class "A\B" not found, it tries to autoload class "A\B" ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TI7Eq
function name:  (null)
number of ops:  39
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_NS_FCALL_BY_NAME                                    'A%5Cfoo'
          1        DO_FCALL                                      0          
   18     2        INIT_FCALL_BY_NAME                                       'A%5Cmy%5Cfoo'
          3        DO_FCALL                                      0          
   20     4        INIT_NS_FCALL_BY_NAME                                    'A%5CF'
          5        DO_FCALL                                      0          
   25     6        NEW                                              $3      'A%5CB'
          7        DO_FCALL                                      0          
          8        FREE                                                     $3
   28     9        NEW                                              $5      'B%5CD'
         10        DO_FCALL                                      0          
         11        FREE                                                     $5
   31    12        NEW                                              $7      'C%5CE'
         13        DO_FCALL                                      0          
         14        FREE                                                     $7
   34    15        NEW                                              $9      'B'
         16        DO_FCALL                                      0          
         17        FREE                                                     $9
   37    18        NEW                                              $11     'D'
         19        DO_FCALL                                      0          
         20        FREE                                                     $11
   40    21        NEW                                              $13     'F'
         22        DO_FCALL                                      0          
         23        FREE                                                     $13
   45    24        INIT_FCALL_BY_NAME                                       'A%5CB%5Cfoo'
         25        DO_FCALL                                      0          
   47    26        INIT_STATIC_METHOD_CALL                                  'A%5CB', 'foo'
         27        DO_FCALL                                      0          
   50    28        INIT_STATIC_METHOD_CALL                                  'B%5CD', 'foo'
         29        DO_FCALL                                      0          
   53    30        INIT_FCALL_BY_NAME                                       'B%5Cfoo'
         31        DO_FCALL                                      0          
   55    32        INIT_STATIC_METHOD_CALL                                  'B', 'foo'
         33        DO_FCALL                                      0          
   60    34        INIT_STATIC_METHOD_CALL                                  'A%5CA%5CB', 'foo'
         35        DO_FCALL                                      0          
   63    36        INIT_STATIC_METHOD_CALL                                  'A%5CB', 'foo'
         37        DO_FCALL                                      0          
   65    38      > RETURN                                                   1

Function a%5Cfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TI7Eq
function name:  A\foo
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ECHO                                                     'A'
          1      > RETURN                                                   null

End of function a%5Cfoo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.43 ms | 1403 KiB | 15 Q