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; echo 'Checking if "__DIR__" is defined.' . PHP_EOL; if (!defined('__DIR__')) { echo 'No, "__DIR__" is not defined. Defining it now.' . PHP_EOL; define('__DIR__', 'bar'); echo 'Checking again if "__DIR__" is defined.' . PHP_EOL; if (!defined('__DIR__')) { echo 'Damn! *Seems like* "__DIR__" is still not defined.' . PHP_EOL; } else{ echo 'Strike, "__DIR__" is defined now.' . PHP_EOL; } echo 'Anyway, here is what `var_dump(__DIR__)` returns:' . PHP_EOL; var_dump(__DIR__); } else{ echo 'Yep, "__DIR__" is defined.' . PHP_EOL; }

preferences:
44.06 ms | 402 KiB | 5 Q