3v4l.org

run code in 300+ PHP versions simultaneously
<?php class version_info { private $vi = array(); 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 as $item { echo $item['name'] . ' ' . $item['filename'] . "\n"; } } } $sc_version_info = new version_info(); $sc_version_info->add('Test', '/admin/test.php'); f('Test2', '/admin/test2.php'); $sc_version_info->dump(); function f($a, $b) { global $sc_version_info; $sc_version_info->add($a, $b); }
Output for 5.4.0 - 5.4.22
Parse error: syntax error, unexpected 'echo' (T_ECHO) in /in/ed43m on line 16
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_ECHO in /in/ed43m on line 16
Process exited with code 255.

preferences:
211 ms | 1395 KiB | 58 Q