3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { static function __set($a, $b) { echo "__set($a, $b)", PHP_EOL; } } class Bar { private function __set($a, $b) { echo "__set($a, $b)", PHP_EOL; } } $foo = new Foo(); $foo->a = "a"; $bar = new Bar(); $bar->b = 'b';
Output for 5.3.0 - 7.1.0
Warning: The magic method __set() must have public visibility and cannot be static in /in/IABuG on line 4 Warning: The magic method __set() must have public visibility and cannot be static in /in/IABuG on line 10 __set(a, a) __set(b, b)
Output for 5.1.0 - 5.2.17
__set(a, a) __set(b, b)
Output for 5.0.2 - 5.0.5
__set(a, a) Fatal error: Call to private method Bar::__set() from context '' in /in/IABuG on line 19
Process exited with code 255.
Output for 5.0.0 - 5.0.1
__set(a, a) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/IABuG on line 5 PHP_EOL Fatal error: Call to private method Bar::__set() from context '' in /in/IABuG on line 19
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/IABuG on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/IABuG on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/IABuG on line 4
Process exited with code 255.