3v4l.org

run code in 300+ PHP versions simultaneously
<?php $base = sys_get_temp_dir() . '/gh10232-base'; if (!is_dir($base)) { mkdir($base) or die; } $files = [ 'gh10232.php' => <<<'END' <?php set_include_path('gh10232-nonexistent') or exit(1); chdir(__DIR__) or exit(1); spl_autoload_register(function () { trigger_error(__LINE__); $ex = new Exception(); echo 'Exception on line ', $ex->getLine(), "\n"; require_once __DIR__ . '/gh10232/constant_def.inc'; }, true); class ConstantRef { public const VALUE = ConstantDef::VALUE; } ConstantRef::VALUE; END, 'gh10232/constant_def.inc' => <<<'END' <?php trigger_error(basename(__FILE__)); $ex = new Exception(); echo 'Exception in ', basename($ex->getFile()), ' on line ', $ex->getLine(), "\n"; require_once 'required.inc'; // The script of the same directory. class ConstantDef { const VALUE = true; } END, 'gh10232/required.inc' => <<<'END' <?php trigger_error(basename(__FILE__)); $ex = new Exception(); echo 'Exception in ', basename($ex->getFile()), ' on line ', $ex->getLine(), "\n"; END, ]; foreach ($files as $path => $content) { $path = $base . '/' . $path; if (!is_dir(dirname($path))) { mkdir(dirname($path)); } file_put_contents($path, $content); } require_once $base . '/' . (function_exists('array_key_first') ? array_key_first($files) : key($files));
Output for git.master, git.master_jit
Notice: 7 in /tmp/gh10232-base/gh10232.php on line 16 Exception on line 16 Notice: constant_def.inc in /tmp/gh10232-base/gh10232.php on line 16 Exception in gh10232.php on line 16 Warning: require_once(required.inc): Failed to open stream: No such file or directory in /tmp/gh10232-base/gh10232.php on line 16 Fatal error: Uncaught Error: Failed opening required 'required.inc' (include_path='gh10232-nonexistent') in /tmp/gh10232-base/gh10232.php:16 Stack trace: #0 /tmp/gh10232-base/gh10232/constant_def.inc(7): [constant expression]() #1 /tmp/gh10232-base/gh10232.php(10): require_once() #2 /tmp/gh10232-base/gh10232.php(19): {closure:/tmp/gh10232-base/gh10232.php:6}('ConstantDef') #3 /in/v4nl0(62): require_once('/tmp/gh10232-ba...') #4 {main} thrown in /tmp/gh10232-base/gh10232.php on line 16
Process exited with code 255.
Output for rfc.property-hooks
Notice: 7 in /tmp/gh10232-base/gh10232.php on line 16 Exception on line 16 Notice: constant_def.inc in /tmp/gh10232-base/gh10232.php on line 16 Exception in gh10232.php on line 16 Warning: require_once(required.inc): Failed to open stream: No such file or directory in /tmp/gh10232-base/gh10232.php on line 16 Fatal error: Uncaught Error: Failed opening required 'required.inc' (include_path='gh10232-nonexistent') in /tmp/gh10232-base/gh10232.php:16 Stack trace: #0 /tmp/gh10232-base/gh10232/constant_def.inc(7): [constant expression]() #1 /tmp/gh10232-base/gh10232.php(10): require_once() #2 /tmp/gh10232-base/gh10232.php(19): {closure}('ConstantDef') #3 /in/v4nl0(62): require_once('/tmp/gh10232-ba...') #4 {main} thrown in /tmp/gh10232-base/gh10232.php on line 16
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
75.62 ms | 408 KiB | 5 Q