3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class s { const seven = 7; static $y = array(seven, 'seven', 7); function s($x) { static $y = array(seven, 'seven', 7); $y[] = $x; return $y; } } const seven = 7; function foo($x) { static $y = array(seven, 'seven', 7); $y[] = $x; return $y; } new s(2); var_export(foo(4)); var_export(foo(3));
based on VHqKh
Output for 7.0.0 - 7.2.0
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; s has a deprecated constructor in /in/k9Etm on line 3 array ( 0 => 7, 1 => 'seven', 2 => 7, 3 => 4, )array ( 0 => 7, 1 => 'seven', 2 => 7, 3 => 4, 4 => 3, )
Output for 5.3.20 - 5.6.28
array ( 0 => 7, 1 => 'seven', 2 => 7, 3 => 4, )array ( 0 => 7, 1 => 'seven', 2 => 7, 3 => 4, 4 => 3, )