3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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();
based on 2LYVJ
Output for 7.2.0
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.1.10
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.3.18 - 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