3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class FunkyException extends Exception { protected $errors = ['blah']; public function __construct ($message, $errors) { $this->message = $message; $this->errors = $errors; parent::__construct($message); } public function getErrors() { return $this->errors; } } try { throw new FunkyException ('test', ['this','that']); } catch (FunkyException $e) { print_r ($e->getErrors()); }
based on eSdMf
Output for 5.4.10 - 7.2.0
Array ( [0] => this [1] => that )
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/luSW3 on line 5
Process exited with code 255.