3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class FunkyException extends Exception { protected $errors = ['blah']; public function __constructor ($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 cgDKE
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Wrong parameters for FunkyException([string $message [, long $code [, Throwable $previous = NULL]]]) in /in/eSdMf:23 Stack trace: #0 /in/eSdMf(23): Exception->__construct('test', Array) #1 {main} thrown in /in/eSdMf on line 23
Process exited with code 255.
Output for 5.4.10 - 5.6.28
Fatal error: Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]]) in /in/eSdMf on line 23
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/eSdMf on line 5
Process exited with code 255.