 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
PHP Throwable interface
Introduction
In PHP 7, Throwable interface acts as base for any object that can be a parameter to throw statement, including Error and Exception. Both Error and Exception classes, from which predefined and user defined error and exception classes are derived respectively, implement Throwable interface. Following abstract methods are defined in Throwable interface −
Syntax
Throwable {    /* Methods */    abstract public getMessage ( void ) : string    abstract public getCode ( void ) : int    abstract public getFile ( void ) : string    abstract public getLine ( void ) : int    abstract public getTrace ( void ) : array    abstract public getTraceAsString ( void ) : string    abstract public getPrevious ( void ) : Throwable    abstract public __toString ( void ) : string } Methods
getMessage ( void ) − string -> Returns the message associated with the thrown object.
getCode ( void ) − int -> Returns the error code associated with the thrown object.
getFile ( void ) − string -> Get the name of the file in which the thrown object was created.
getLine ( void ) − int -> Returns the line number where the thrown object was instantiated.
getTrace ( void ) − array -> Returns the stack trace as an array.
getTraceAsString ( void ) − string -> Returns the stack trace as a string.
getPrevious ( void ) − Throwable -> Returns any previous Throwable (provided as third parameter to Exception::__construct()).
__toString ( void ) − string -> Gets a string representation of the thrown object
