3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Obj { public $str1 = 'foo'; public $str2 = 'bar'; } $obj = new Obj; foreach($obj as $s) var_dump($s); echo 'string: ' . vsprintf('%s %s', $obj);
Output for 5.0.0 - 7.1.0
string(3) "foo" string(3) "bar" string: foo bar
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/9I6QW on line 3
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_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/9I6QW on line 3
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/9I6QW on line 3
Process exited with code 255.