3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class version_info { private $vi; function __construct() { $this->vi = array(); } function add($name, $filename) { $this->vi[$filename] = array( 'name' => $name, 'filename' => $filename ); } function dump() { // temporary for debugging foreach ($this->vi $key as $item) { echo $key . ': ' . $item['name'] . ' ' . $item['filename'] . "\n"; } } } function f($a, $b) { global $sc_version_info; $sc_version_info->add($a, $b); } $sc_version_info = new version_info(); $sc_version_info->add('Test', '/admin/test.php'); f('Test2', '/admin/test2.php'); $sc_version_info->dump();
Output for 5.4.0 - 5.4.22
Parse error: syntax error, unexpected '$key' (T_VARIABLE) in /in/8l1tf on line 15
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_VARIABLE in /in/8l1tf on line 15
Process exited with code 255.