3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(php_uname('s')); $base_dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR; file_put_contents($base_dir . 'Baz.php', "<?php namespace Foo\Bar; class BAZ {}"); file_put_contents($base_dir . 'Buz.php', "<?php namespace Foo\Bar; class Buz {}"); require_once 'https://raw.github.com/php-fig/fig-standards/master/accepted/PSR-4-autoloader-examples.md'; // spl_autoload_register(function ($class) { // // project-specific namespace prefix // $prefix = 'Foo\\Bar\\'; // // base directory for the namespace prefix // global $base_dir; # = __DIR__ . '/src/'; // // does the class use the namespace prefix? // $len = strlen($prefix); // if (strncmp($prefix, $class, $len) !== 0) { // // no, move to the next registered autoloader // return; // } // // get the relative class name // $relative_class = substr($class, $len); // // replace the namespace prefix with the base directory, replace namespace // // separators with directory separators in the relative class name, append // // with .php // $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; // // if the file exists, require it // if (file_exists($file)) { // require $file; // } // }); $c1 = new \Foo\Bar\Baz(); $c2 = new \Foo\Bar\BAZ(); var_dump($c1 == $c2); $c3 = new \Foo\Bar\BUZ(); $c4 = new \Foo\Bar\Buz(); var_dump($c3 == $c4);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EMtk5
function name:  (null)
number of ops:  42
compiled vars:  !0 = $base_dir, !1 = $c1, !2 = $c2, !3 = $c3, !4 = $c4
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'php_uname'
          2        SEND_VAL                                                 's'
          3        DO_ICALL                                         $5      
          4        SEND_VAR                                                 $5
          5        DO_ICALL                                                 
    5     6        INIT_FCALL                                               'sys_get_temp_dir'
          7        DO_ICALL                                         $7      
          8        CONCAT                                           ~8      $7, '%2F'
          9        ASSIGN                                                   !0, ~8
    7    10        INIT_FCALL                                               'file_put_contents'
         11        CONCAT                                           ~10     !0, 'Baz.php'
         12        SEND_VAL                                                 ~10
         13        SEND_VAL                                                 '%3C%3Fphp+namespace+Foo%5CBar%3B+class+BAZ+%7B%7D'
         14        DO_ICALL                                                 
    8    15        INIT_FCALL                                               'file_put_contents'
         16        CONCAT                                           ~12     !0, 'Buz.php'
         17        SEND_VAL                                                 ~12
         18        SEND_VAL                                                 '%3C%3Fphp+namespace+Foo%5CBar%3B+class+Buz+%7B%7D'
         19        DO_ICALL                                                 
   10    20        INCLUDE_OR_EVAL                                          'https%3A%2F%2Fraw.github.com%2Fphp-fig%2Ffig-standards%2Fmaster%2Faccepted%2FPSR-4-autoloader-examples.md', REQUIRE_ONCE
   41    21        NEW                                              $15     'Foo%5CBar%5CBaz'
         22        DO_FCALL                                      0          
         23        ASSIGN                                                   !1, $15
   42    24        NEW                                              $18     'Foo%5CBar%5CBAZ'
         25        DO_FCALL                                      0          
         26        ASSIGN                                                   !2, $18
   44    27        INIT_FCALL                                               'var_dump'
         28        IS_EQUAL                                         ~21     !1, !2
         29        SEND_VAL                                                 ~21
         30        DO_ICALL                                                 
   46    31        NEW                                              $23     'Foo%5CBar%5CBUZ'
         32        DO_FCALL                                      0          
         33        ASSIGN                                                   !3, $23
   47    34        NEW                                              $26     'Foo%5CBar%5CBuz'
         35        DO_FCALL                                      0          
         36        ASSIGN                                                   !4, $26
   49    37        INIT_FCALL                                               'var_dump'
         38        IS_EQUAL                                         ~29     !3, !4
         39        SEND_VAL                                                 ~29
         40        DO_ICALL                                                 
         41      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.3 ms | 1400 KiB | 21 Q