3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class LogDebug { } class LogError { function __construct($s) { echo "logged $s\n"; } } function foo($x) { echo "called $x\n"; return $x; } new LogDebug(foo(1)); new LogError(foo(2));
based on ljQ8F
Output for 7.1.0
called 1 called 2 logged 2
Output for 5.0.0 - 7.0.14
called 2 logged 2
Output for 4.3.0 - 4.4.9