3v4l.org

run code in 300+ PHP versions simultaneously
<?php define("CONSTANT", "Hello world."); echo CONSTANT; // outputs "Hello world." echo Constant; // outputs "Constant" and issues a notice. echo PHP_EOL; define("GREETING", "Hello you.", true); echo GREETING; // outputs "Hello you." echo Greeting; // outputs "Hello you." echo PHP_EOL; // Works as of PHP 7 define('ANIMALS', array( 'dog', 'cat', 'bird' )); echo PHP_EOL; echo ANIMALS[1]; // outputs "cat"
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Hello world. Fatal error: Uncaught Error: Undefined constant "Constant" in /in/HOINP:4 Stack trace: #0 {main} thrown in /in/HOINP on line 4
Process exited with code 255.
Output for 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
Hello world. Warning: Use of undefined constant Constant - assumed 'Constant' (this will throw an Error in a future version of PHP) in /in/HOINP on line 4 Constant Deprecated: define(): Declaration of case-insensitive constants is deprecated in /in/HOINP on line 7 Hello you. Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "GREETING" in /in/HOINP on line 9 Hello you. cat
Output for 7.2.0 - 7.2.33, 7.3.32 - 7.3.33
Hello world. Warning: Use of undefined constant Constant - assumed 'Constant' (this will throw an Error in a future version of PHP) in /in/HOINP on line 4 Constant Hello you.Hello you. cat
Output for 7.0.0 - 7.0.31, 7.1.0 - 7.1.23
Hello world. Notice: Use of undefined constant Constant - assumed 'Constant' in /in/HOINP on line 4 Constant Hello you.Hello you. cat
Output for 5.6.0 - 5.6.38
Hello world. Notice: Use of undefined constant Constant - assumed 'Constant' in /in/HOINP on line 4 Constant Hello you.Hello you. Warning: Constants may only evaluate to scalar values in /in/HOINP on line 17 Notice: Use of undefined constant ANIMALS - assumed 'ANIMALS' in /in/HOINP on line 19 N
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38
Parse error: syntax error, unexpected '[', expecting ',' or ';' in /in/HOINP on line 19
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[', expecting ',' or ';' in /in/HOINP on line 19
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `','' or `';'' in /in/HOINP on line 19
Process exited with code 255.

preferences:
317.91 ms | 401 KiB | 415 Q