3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Post { protected $title; protected $text; protected $filters; function __construct($title, $text, $filters) { $this->title = $title; $this->text = $text; $this->filters = $filters; } function get_title() { return htmlspecialchars($this->title); } function display_post() { $text = htmlspecialchars($this->text); foreach ($this->filters as $filter) { $text = $filter->filter($text); } return $text; } function __destruct() { // debugging stuff $s = "<!-- POST " . htmlspecialchars($this->title); $text = htmlspecialchars($this->text); foreach ($this->filters as $filter) { $text = $filter->filter($text); } $s = $s . ": " . $text; $s = $s . " -->"; echo $s; } } echo serialize(new Post("hello", "world", new Array()));
based on GncJB
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.4.0 - 5.4.34
Parse error: syntax error, unexpected 'Array' (T_ARRAY) in /in/kBgBJ on line 34
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_ARRAY in /in/kBgBJ on line 34
Process exited with code 255.
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_ARRAY, expecting T_STRING or T_VARIABLE or '$' in /in/kBgBJ on line 34
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_ARRAY, expecting T_STRING or T_VARIABLE or '$' in /in/kBgBJ on line 34
Process exited with code 255.
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/kBgBJ 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/kBgBJ 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/kBgBJ on line 3
Process exited with code 255.