PHP.mk документација

UnderflowException

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

class.underflowexception.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека class.underflowexception.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
UnderflowException

Референца за `class.underflowexception.php` со подобрена типографија и навигација.

class.underflowexception.php

Класата UnderflowException

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

Вовед

Исклучок фрлен при извршување на невалидна операција на празен контејнер, како што е отстранување на елемент.

Синопсис на класата

class UnderflowException extends RuntimeException {
/* Наследени својства */
protected string $message = "";
private string $string = "";
protected int $code;
protected string $file = "";
protected int $line;
private array $trace = [];
/* Наследени методи */
public Exception::__construct(string $message = "", int $code = 0, ?Проверува тврдење $previous = null)
final public Exception::getCode(): int
final public Exception::getFile(): string
final public Exception::getLine(): int
final public Exception::getTrace(): array
}

Белешки од корисници 1 белешка

Јакуб Адамчик
3 години пред
The most typical usage is with stack, queue or collection, for example when you queue tasks, make call stack or manipulate JSON, XML, etc. elements.

As other exepctions of RuntimeException class, this type of error can't be detected in (for example) your IDE or compiler.

<?php
// Functions declared above 
$f1 = function() { setTypeControl('username');};
$f2 = function() { setTypeControl('userpass');};
$f3 = function() { setButton('Add');};
$f4 = function() { setButton('OK');};

$tasks = new class {
    private $list;

    // Create internal queue
    public function __construct() {
        $this->list = new SplQueue;
    }

    // Add to queue
    public function add(callable $func) {
        $this->list->enqueue($func);
    }

    // Delete from queue and execute
    public function do() {
        if ($this->list->isEmpty()) {
            throw new UnderflowException;
        } else {
            call_user_func($this->list->dequeue());
        }
    }

};

$tasks->add($f1);
$tasks->add($f2);
$tasks->add($f3);
$tasks->add($f4);

$tasks->do(); // Field username is created
$tasks->do(); // Field userpass is created
$tasks->do(); // Button Add is created
$tasks->do(); // Button OK is created
$tasks->do(); // Fatal error: Uncaught UnderflowException in ...
На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.