3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class version_info { private $vi = array(); // Version Information Array function __construct() { //$this->vi = array(); } function add($name, $filename, $doc = 0, $date, $ver) { $this->vi[$filename] = array( 'name' => $name, 'filename' => $filename, 'document' => $doc, // Include in automatic SiteCommander tech documentation 'version' => $ver, 'date' => $date ); } function dump() { // temporary for debugging print_r($this->vi); } } /* end of class version_info */ $sc_version_info = new version_info(); $sc_version_info->add('Test', '/admin/test2.php', 1, 2, 3); f('Test', '/admin/test.php', 4, 5, 6); $sc_version_info->dump(); function f($a, $b, $c, $d, $e) { global $sc_version_info; $sc_version_info->add($a, $b, $c, $d, $e); }
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [/admin/test2.php] => Array ( [name] => Test [filename] => /admin/test2.php [document] => 1 [version] => 3 [date] => 2 ) [/admin/test.php] => Array ( [name] => Test [filename] => /admin/test.php [document] => 4 [version] => 6 [date] => 5 ) )
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/2AZhb 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/2AZhb 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/2AZhb on line 3
Process exited with code 255.