La clase OutOfRangeException

(PHP 5 >= 5.1.0, PHP 7)


Lanza una excepción cuando se solicita un índice ilegal. Esto representa un error que debe ser detectado en tiempo de compilación.

Sinopsis de la Clase

OutOfRangeException extends LogicException {
/* Propiedades heredadas */
protected string $message ;
protected int $code ;
protected string $file ;
protected int $line ;
/* Métodos heredados */
final public string Exception::getMessage ( void )
final public Exception 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

10 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
1 year ago
Exemple :

$calendar = new Calendar();
To Top