3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Session { private $data; function __construct() { session_id() or session_start(); if (!isset($_SESSION['test'])) $_SESSION['test'] = array(); $this->data = &$_SESSION['test']; } function set($key, $value) { $this->data[$key] = $value; }; function get($Key) { return $this->data[$key]; }; } $s = new Session(); $s->set('foo', 'coins'); $s->set('ix', 'janz23'); var_dump($_SESSION);
Output for 5.4.0 - 5.4.27
Parse error: syntax error, unexpected ';', expecting function (T_FUNCTION) in /in/eveYE on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /in/eveYE on line 10
Process exited with code 255.

preferences:
223.48 ms | 1395 KiB | 64 Q