3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Ex extends Exception { private $code; public function __construct($message, $code) { $this->code = $code; parent::__construct($message); } } try { throw new Exception('aaa', 'aaa'); } catch (Exception $e) { var_dump($e->getCode()); }
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.30
Fatal error: Access level to Ex::$code must be protected (as in class Exception) or weaker in /in/aiK9B on line 9
Process exited with code 255.

preferences:
190.5 ms | 1395 KiB | 67 Q