3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // File "load.php". namespace Foo\Bar { class load { static public function arithmetic() { require_once __DIR__ . '/arithmetic.php'; } } } // File "arithmetic.php". namespace Foo\Bar\Functions { function add($a, $b) { return $a + $b; } const add = 'Foo\Bar\Functions\add'; } // User app. namespace Some\App { use Foo\Bar\load; use Foo\Bar\Functions as f; load::arithmetic(); echo f\add(5, 6) . "\n"; // 11 $callable = f\add; echo $callable(5, 6); // 11 }
based on at8Z9
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/C3qjv
function name:  (null)
number of ops:  19
compiled vars:  !0 = $callable
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   5     0  E >   NOP                                                      
  14     1        NOP                                                      
  18     2        DECLARE_CONST                                            'Foo%5CBar%5CFunctions%5Cadd', 'Foo%5CBar%5CFunctions%5Cadd'
  26     3        INIT_STATIC_METHOD_CALL                                  'Foo%5CBar%5Cload', 'arithmetic'
         4        DO_FCALL                                      0          
  28     5        INIT_FCALL                                               'foo%5Cbar%5Cfunctions%5Cadd'
         6        SEND_VAL                                                 5
         7        SEND_VAL                                                 6
         8        DO_FCALL                                      0  $3      
         9        CONCAT                                           ~4      $3, '%0A'
        10        ECHO                                                     ~4
  30    11        FETCH_CONSTANT                                   ~5      'Foo%5CBar%5CFunctions%5Cadd'
        12        ASSIGN                                                   !0, ~5
  31    13        INIT_DYNAMIC_CALL                                        !0
        14        SEND_VAL_EX                                              5
        15        SEND_VAL_EX                                              6
        16        DO_FCALL                                      0  $7      
        17        ECHO                                                     $7
        18      > RETURN                                                   1

Function foo%5Cbar%5Cfunctions%5Cadd:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/C3qjv
function name:  Foo\Bar\Functions\add
number of ops:  5
compiled vars:  !0 = $a, !1 = $b
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  14     0  E >   RECV                                             !0      
         1        RECV                                             !1      
  15     2        ADD                                              ~2      !0, !1
         3      > RETURN                                                   ~2
  16     4*     > RETURN                                                   null

End of function foo%5Cbar%5Cfunctions%5Cadd

Class Foo\Bar\load:
Function arithmetic:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/C3qjv
function name:  arithmetic
number of ops:  2
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   7     0  E >   INCLUDE_OR_EVAL                                          '%2Fin%2Farithmetic.php', REQUIRE_ONCE
   8     1      > RETURN                                                   null

End of function arithmetic

End of class Foo\Bar\load.

Generated using Vulcan Logic Dumper, using php 7.3.0