3v4l.org

run code in 300+ PHP versions simultaneously
<?php $code = <<<EOB trait my_trait { static function test(\$arg) { echo \$arg; } } EOB; function my_autoloader($class) { global $code; echo "autoloading $class\n"; eval($code); } spl_autoload_register('my_autoloader'); class try_it { use my_trait; } try_it::test("does it work?\n");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d4BrG
function name:  (null)
number of ops:  9
compiled vars:  !0 = $code
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'trait+my_trait+%7B%0A++static+function+test%28%24arg%29+%7B+echo+%24arg%3B+%7D%0A%7D'
   14     1        INIT_FCALL                                               'spl_autoload_register'
          2        SEND_VAL                                                 'my_autoloader'
          3        DO_ICALL                                                 
   16     4        DECLARE_CLASS                                            'try_it'
   20     5        INIT_STATIC_METHOD_CALL                                  'try_it', 'test'
          6        SEND_VAL_EX                                              'does+it+work%3F%0A'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function my_autoloader:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d4BrG
function name:  my_autoloader
number of ops:  8
compiled vars:  !0 = $class, !1 = $code
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        BIND_GLOBAL                                              !1, 'code'
   10     2        ROPE_INIT                                     3  ~3      'autoloading+'
          3        ROPE_ADD                                      1  ~3      ~3, !0
          4        ROPE_END                                      2  ~2      ~3, '%0A'
          5        ECHO                                                     ~2
   11     6        INCLUDE_OR_EVAL                                          !1, EVAL
   12     7      > RETURN                                                   null

End of function my_autoloader

Class try_it: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.7 ms | 1395 KiB | 15 Q