3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); echo 'Testing on PHP version ' . PHP_VERSION . PHP_EOL . PHP_EOL; sleep(1); echo 'Checking if `__DIR__` is defined...' . PHP_EOL; if (!defined('__DIR__')) { sleep(2); echo 'Nope, `defined()` returned `(bool)false`.' . PHP_EOL; echo 'So, seems like the magic constant `__DIR__` is not defined.' . PHP_EOL . PHP_EOL; sleep(2); echo 'No prob. Executing `define(\'__DIR__\', \'/foo/bar\')`...' . PHP_EOL; define('__DIR__', '/foo/bar'); sleep(1); echo 'Done, defined `__DIR__` as "/foo/bar".' . PHP_EOL . PHP_EOL; sleep(1); echo 'Double-checking `__DIR__` is defined now...' . PHP_EOL; sleep(2); if (!defined('__DIR__')) { echo 'WTF, `defined(\'__DIR__\')` again returned `(bool)false`?!' . PHP_EOL; } else{ echo 'Strike, this time `defined(\'__DIR__\')` returned `(bool)true`.' . PHP_EOL; echo 'So, seems like `__DIR__` was successfully defined. :)' . PHP_EOL . PHP_EOL; } } else{ echo 'Yep, `defined(\'__DIR__\')` returned `(bool)true`.' . PHP_EOL; echo 'The magic constant `__DIR__` seems to be defined.' . PHP_EOL . PHP_EOL; } sleep(2); echo 'Finally, here is the result of `var_dump(__DIR__)`:' . PHP_EOL; var_dump(__DIR__);
Output for git.master, git.master_jit, rfc.property-hooks
Testing on PHP version 8.3.0-dev Checking if `__DIR__` is defined...
Process exited with code 137.

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:
43.73 ms | 401 KiB | 8 Q