This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

  • PHP Exception Reference

  • PHP Exception Object

    • Exceptions are used by functions and methods to send information about errors and unexpected behaviour.
    • The Exception object has no public properties, but it has private and protected properties which can be written to or read from using the constructor and methods.
    • The Exception object has the following methods:
    Method Description
    Exception() The constructor of the Exception object
    getCode() Returns the exception code
    getFile() Returns the full path of the file in which the exception was thrown
    getMessage() Returns a string describing why the exception was thrown
    getLine() Returns the line number of the line of code which threw the exception
    getPrevious() If this exception was triggered by another one, this method returns the previous exception. If not, then it returns null
    getTrace() Returns an array with information about all of the functions that were running at the time the exception was thrown
    getTraceAsString() Returns the same information as getTrace(), but in a string
    Navigate this PHP reference guide

    Eventually the navigation links, above, will be replaced by these << (previous) and >> (next) buttons below.



    Animated PHP icons used in the buttons provided by ICONS8.COM. Smartphone icons created by Freepik - Flaticon

    PHP Quiz