PHP 7.2.0 Beta 1 Released

The OutOfRangeException class

(PHP 5 >= 5.1.0, PHP 7)


Exception thrown when an illegal index was requested. This represents errors that should be detected at compile time.

Sommario dellla classe

OutOfRangeException extends LogicException {
/* Proprietà ereditate */
protected string $message ;
protected int $code ;
protected string $file ;
protected int $line ;
/* Metodi ereditati */
final public string Exception::getMessage ( void )
final public Throwable Exception::getPrevious ( void )
final public mixed Exception::getCode ( void )
final public string Exception::getFile ( void )
final public int Exception::getLine ( void )
final public array Exception::getTrace ( void )
final public string Exception::getTraceAsString ( void )
public string Exception::__toString ( void )
final private void Exception::__clone ( void )
add a note add a note

User Contributed Notes 2 notes

2 months ago
I see this in this way:
By definiton, OutOfRangeException should be use to when potential problem is logical - occurs because of wrong code or definition. OutOfBoundsException is for runtime.

Example (see also note in "OutOfBoundsException class" article):
function prepareData(PDOStatement $s) {
$x = $s->fetch();
    if (!isset(
        throw new
OutOfRangeException ("Secret column doesn't exist! Verify table definition and query.");
evguenia dot chagnon at gmail dot com
5 months ago
Exemple :

$calendar = new Calendar();
To Top