3v4l.org

run code in 300+ PHP versions simultaneously
<?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/test.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.4.0 - 5.4.22
Parse error: syntax error, unexpected 'global' (T_GLOBAL), expecting '{' in /in/he4DY on line 27
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_GLOBAL, expecting '{' in /in/he4DY on line 27
Process exited with code 255.

preferences:
188.32 ms | 1394 KiB | 58 Q