3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class FunkyException extends Exception { protected $errors = []; public function __constructor ($message, $errors) { $this->message = $message; $this->errors = $errors; } public function getErrors() { return $this->errors; } } try { throw new Exception ('test', ['this','that']); } catch (FunkyException $e) { print_r ($e->getErrors()); }
based on dpSuC
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Wrong parameters for Exception([string $message [, long $code [, Throwable $previous = NULL]]]) in /in/7DoqZ:21 Stack trace: #0 /in/7DoqZ(21): Exception->__construct('test', Array) #1 {main} thrown in /in/7DoqZ on line 21
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/7DoqZ on line 21
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/7DoqZ on line 5
Process exited with code 255.