Exception

(PHP 5, PHP 7, PHP 8)

Introduction

Exception is the base class for all user exceptions.

Class synopsis

classExceptionimplementsThrowable {
protectedstring$message = "";
privatestring$string = "";
protectedint$code;
protectedstring$file = "";
protectedint$line;
privatearray$trace = [];
private?Throwable$previous = null;
public__construct(string$message = "", int$code = 0, ?Throwable$previous = null)
finalpublicgetMessage(): string
finalpublicgetPrevious(): ?Throwable
finalpublicgetCode(): int
finalpublicgetFile(): string
finalpublicgetLine(): int
finalpublicgetTrace(): array
finalpublicgetTraceAsString(): string
private__clone(): void
}

Properties

message

The exception message

code

The exception code

file

The filename where the exception was created

line

The line where the exception was created

previous

The previously thrown exception

string

The string representation of the stack trace

trace

The stack trace as an array

Table of Contents

To Top