3v4l.org

run code in 300+ PHP versions simultaneously
<?php function autocreate($classname) { if (substr($classname, -strlen('Exception')) == 'Exception') eval('class ' . $classname . ' extends Exception {};'); } spl_autoload_register('autocreate'); $x = new TestException(); var_dump(get_class($x)); $z = "echo 'moo';"; $x = new $z(); var_dump(get_class($x));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h4Gua
function name:  (null)
number of ops:  20
compiled vars:  !0 = $x, !1 = $z
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'spl_autoload_register'
          1        SEND_VAL                                                 'autocreate'
          2        DO_ICALL                                                 
   10     3        NEW                                              $3      'TestException'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $3
   12     6        INIT_FCALL                                               'var_dump'
          7        GET_CLASS                                        ~6      !0
          8        SEND_VAL                                                 ~6
          9        DO_ICALL                                                 
   14    10        ASSIGN                                                   !1, 'echo+%27moo%27%3B'
   16    11        FETCH_CLASS                                   0  $9      !1
         12        NEW                                              $10     $9
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !0, $10
   18    15        INIT_FCALL                                               'var_dump'
         16        GET_CLASS                                        ~13     !0
         17        SEND_VAL                                                 ~13
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Function autocreate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/h4Gua
function name:  autocreate
number of ops:  11
compiled vars:  !0 = $classname
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'substr'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 -9
          4        DO_ICALL                                         $1      
          5        IS_EQUAL                                                 $1, 'Exception'
          6      > JMPZ                                                     ~2, ->10
    5     7    >   CONCAT                                           ~3      'class+', !0
          8        CONCAT                                           ~4      ~3, '+extends+Exception+%7B%7D%3B'
          9        INCLUDE_OR_EVAL                                          ~4, EVAL
    6    10    > > RETURN                                                   null

End of function autocreate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.73 ms | 1396 KiB | 19 Q