3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class AcmeException extends Exception { public function __construct($message, $code = null, $previous = null) { parent::__construct($message, 0, $previous); $this->code = $code; } } $previous = new AcmeException('test', 'invalid'); $second = new Exception('test2', $previous->getCode(), $previous); echo 'done';
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/ObN47:12 Stack trace: #0 /in/ObN47(12): Exception->__construct('test2', 'invalid', Object(AcmeException)) #1 {main} thrown in /in/ObN47 on line 12
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Fatal error: Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]]) in /in/ObN47 on line 12
Process exited with code 255.