3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NewError implements Throwable { //implemented methods /*** * Gets the message * @link http://php.net/manual/en/throwable.getmessage.php * @return string * @since 7.0 */ public function getMessage() { // TODO: Implement getMessage() method. } /** * Gets the exception code * @link http://php.net/manual/en/throwable.getcode.php * @return int <p> * Returns the exception code as integer in * {@see Exception} but possibly as other type in * {@see Exception} descendants (for example as * string in {@see PDOException}). * </p> * @since 7.0 */ public function getCode() { // TODO: Implement getCode() method. } /** * Gets the file in which the exception occurred * @link http://php.net/manual/en/throwable.getfile.php * @return string Returns the name of the file from which the object was thrown. * @since 7.0 */ public function getFile() { // TODO: Implement getFile() method. } /** * Gets the line on which the object was instantiated * @link http://php.net/manual/en/throwable.getline.php * @return int Returns the line number where the thrown object was instantiated. * @since 7.0 */ public function getLine() { // TODO: Implement getLine() method. } /** * Gets the stack trace * @link http://php.net/manual/en/throwable.gettrace.php * @return array <p> * Returns the stack trace as an array in the same format as * {@see debug_backtrace()}. * </p> * @since 7.0 */ public function getTrace() { // TODO: Implement getTrace() method. } /** * Gets the stack trace as a string * @link http://php.net/manual/en/throwable.gettraceasstring.php * @return string Returns the stack trace as a string. * @since 7.0 */ public function getTraceAsString() { // TODO: Implement getTraceAsString() method. } /** * Returns the previous Throwable * @link http://php.net/manual/en/throwable.getprevious.php * @return Throwable Returns the previous {@see Throwable} if available, or <b>NULL</b> otherwise. * @since 7.0 */ public function getPrevious() { // TODO: Implement getPrevious() method. } /** * Gets a string representation of the thrown object * @link http://php.net/manual/en/throwable.tostring.php * @return string <p>Returns the string representation of the thrown object.</p> * @since 7.0 */ public function __toString() { // TODO: Implement __toString() method. } } try{ throw new NewError(); //false-positive }catch(NewError $e){ //false-positive echo $e->getMessage(); }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Declaration of NewError::getMessage() must be compatible with Throwable::getMessage(): string in /in/3gnRh on line 10
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Class NewError cannot implement interface Throwable, extend Exception or Error instead in /in/3gnRh on line 2
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
Fatal error: Interface 'Throwable' not found in /in/3gnRh on line 2
Process exited with code 255.

preferences:
171.32 ms | 402 KiB | 240 Q