3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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; }
Output for 5.4.0 - 5.4.19
Parse error: syntax error, unexpected 'PHP_VERSION' (T_STRING), expecting ',' or ';' in /in/vWXV7 on line 4
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /in/vWXV7 on line 4
Process exited with code 255.