3v4l.org

run code in 300+ PHP versions simultaneously
<?php // define class constant linking to a not defined constant class Foo { const FOO = FOO; } class Bar { const BAR = BAR; } echo 'Define the linked constant AFTER reading: ' . PHP_EOL; Foo::FOO; define('FOO', 'Value of FOO'); var_dump(Foo::FOO); echo 'Define the linked constant BEFORE reading: ' . PHP_EOL; define('BAR', 'Value of BAR'); var_dump(Bar::BAR);

preferences:
28.47 ms | 402 KiB | 5 Q