3v4l.org

run code in 300+ PHP versions simultaneously
<?php assert_options(ASSERT_ENABLED, 1); class foo { public $foo = 1; function as_string() { assert('$this->foo == 1'); } function as_expr() { assert($this->foo == 1); } } $foo = new foo(); $foo->as_expr(); $foo->as_string();
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught Error: Undefined constant "ASSERT_ENABLED" in /in/E6MIp:2 Stack trace: #0 {main} thrown in /in/E6MIp on line 2
Process exited with code 255.
Output for 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Warning: Use of undefined constant ASSERT_ENABLED - assumed 'ASSERT_ENABLED' (this will throw an Error in a future version of PHP) in /in/E6MIp on line 2 Warning: assert_options() expects parameter 1 to be int, string given in /in/E6MIp on line 2 Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/E6MIp on line 8
Output for 7.3.32 - 7.3.33
Warning: Use of undefined constant ASSERT_ENABLED - assumed 'ASSERT_ENABLED' (this will throw an Error in a future version of PHP) in /in/E6MIp on line 2 Warning: assert_options() expects parameter 1 to be int, string given in /in/E6MIp on line 2
Output for 7.2.0 - 7.2.33
Warning: Use of undefined constant ASSERT_ENABLED - assumed 'ASSERT_ENABLED' (this will throw an Error in a future version of PHP) in /in/E6MIp on line 2 Warning: assert_options() expects parameter 1 to be integer, string given in /in/E6MIp on line 2 Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/E6MIp on line 8
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33
Notice: Use of undefined constant ASSERT_ENABLED - assumed 'ASSERT_ENABLED' in /in/E6MIp on line 2 Warning: assert_options() expects parameter 1 to be integer, string given in /in/E6MIp on line 2
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Notice: Use of undefined constant ASSERT_ENABLED - assumed 'ASSERT_ENABLED' in /in/E6MIp on line 2 Warning: assert_options() expects parameter 1 to be long, string given in /in/E6MIp on line 2

preferences:
189.73 ms | 402 KiB | 252 Q