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" \foo(); // calls function "foo" defined in global scope 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/5tG5C
function name:  (null)
number of ops:  41
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          
   17     2        INIT_FCALL_BY_NAME                                       'foo'
          3        DO_FCALL                                      0          
   19     4        INIT_FCALL_BY_NAME                                       'A%5Cmy%5Cfoo'
          5        DO_FCALL                                      0          
   21     6        INIT_NS_FCALL_BY_NAME                                    'A%5CF'
          7        DO_FCALL                                      0          
   26     8        NEW                                              $4      'A%5CB'
          9        DO_FCALL                                      0          
         10        FREE                                                     $4
   29    11        NEW                                              $6      'B%5CD'
         12        DO_FCALL                                      0          
         13        FREE                                                     $6
   32    14        NEW                                              $8      'C%5CE'
         15        DO_FCALL                                      0          
         16        FREE                                                     $8
   35    17        NEW                                              $10     'B'
         18        DO_FCALL                                      0          
         19        FREE                                                     $10
   38    20        NEW                                              $12     'D'
         21        DO_FCALL                                      0          
         22        FREE                                                     $12
   41    23        NEW                                              $14     'F'
         24        DO_FCALL                                      0          
         25        FREE                                                     $14
   46    26        INIT_FCALL_BY_NAME                                       'A%5CB%5Cfoo'
         27        DO_FCALL                                      0          
   48    28        INIT_STATIC_METHOD_CALL                                  'A%5CB', 'foo'
         29        DO_FCALL                                      0          
   51    30        INIT_STATIC_METHOD_CALL                                  'B%5CD', 'foo'
         31        DO_FCALL                                      0          
   54    32        INIT_FCALL_BY_NAME                                       'B%5Cfoo'
         33        DO_FCALL                                      0          
   56    34        INIT_STATIC_METHOD_CALL                                  'B', 'foo'
         35        DO_FCALL                                      0          
   61    36        INIT_STATIC_METHOD_CALL                                  'A%5CA%5CB', 'foo'
         37        DO_FCALL                                      0          
   64    38        INIT_STATIC_METHOD_CALL                                  'A%5CB', 'foo'
         39        DO_FCALL                                      0          
   66    40      > RETURN                                                   1

Function a%5Cfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5tG5C
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:
156.06 ms | 1403 KiB | 15 Q