3v4l.org

run code in 300+ PHP versions simultaneously
<?php function autoload1($class) { echo "1: $class\n"; if ( $class === 'Foo' ) { require '/tmp/autoload1Foo.php'; } } function autoload2($class) { echo "2: $class\n"; require "/tmp/autoload2$class.php"; } file_put_contents( '/tmp/autoload1Foo.php', '<?php class Foo {}' ); file_put_contents( '/tmp/autoload2Bar.php', '<?php class Bar {}' ); spl_autoload_register( 'autoload1' ); spl_autoload_register( 'autoload2' ); $a = new Foo; $b = new Bar;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/phBUL
function name:  (null)
number of ops:  21
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'file_put_contents'
          1        SEND_VAL                                                 '%2Ftmp%2Fautoload1Foo.php'
          2        SEND_VAL                                                 '%3C%3Fphp+class+Foo+%7B%7D'
          3        DO_ICALL                                                 
   17     4        INIT_FCALL                                               'file_put_contents'
          5        SEND_VAL                                                 '%2Ftmp%2Fautoload2Bar.php'
          6        SEND_VAL                                                 '%3C%3Fphp+class+Bar+%7B%7D'
          7        DO_ICALL                                                 
   18     8        INIT_FCALL                                               'spl_autoload_register'
          9        SEND_VAL                                                 'autoload1'
         10        DO_ICALL                                                 
   19    11        INIT_FCALL                                               'spl_autoload_register'
         12        SEND_VAL                                                 'autoload2'
         13        DO_ICALL                                                 
   20    14        NEW                                              $6      'Foo'
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !0, $6
   21    17        NEW                                              $9      'Bar'
         18        DO_FCALL                                      0          
         19        ASSIGN                                                   !1, $9
         20      > RETURN                                                   1

Function autoload1:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/phBUL
function name:  autoload1
number of ops:  9
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ROPE_INIT                                     3  ~2      '1%3A+'
          2        ROPE_ADD                                      1  ~2      ~2, !0
          3        ROPE_END                                      2  ~1      ~2, '%0A'
          4        ECHO                                                     ~1
    5     5        IS_IDENTICAL                                             !0, 'Foo'
          6      > JMPZ                                                     ~4, ->8
    6     7    >   INCLUDE_OR_EVAL                                          '%2Ftmp%2Fautoload1Foo.php', REQUIRE
    8     8    > > RETURN                                                   null

End of function autoload1

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

End of function autoload2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.48 ms | 1392 KiB | 17 Q