3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = <<<PHP define('LOST_CONSTANT', 42); class Foo { public function foo() { // throw notice about deprecated constructor } } PHP; set_error_handler(function($errno, $errstr) { throw new Exception($errstr, $errno); // convert error to exception }); try { eval($foo); } catch (Exception $e) { printf("error %d with message: %s\n", $e->getCode(), $e->getMessage()); } var_dump( class_exists('foo'), // exists! defined('LOST_CONSTANT') // where is my constant );

preferences:
31.84 ms | 402 KiB | 5 Q