CF. DomainException : "DomainException corresponds to RangeException and we should use them in simillar situations. But first exception is designed to use when we are sure the problem is with our project, third-part elements etc. (simply: logical error), the second way is designed to use when we are sure the problem is with input data or environment (simply: runtime error)."
function divide($divident, $input) {
if(!is_numeric($divident) || !is_numeric($input)) {
throw new InvalidArgumentException("Function accepts only numeric values");
}
if($input == 0) {
throw new RangeException("Divisor must not be zero");
}
return $divident / $input;
}
PHP.mk документација
RangeException
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
Патека
class.rangeexception.php
Локална патека за оваа страница.
Извор
php.net/manual/en
Оригиналниот HTML се реупотребува и локално се стилизира.
Режим
Прокси + превод во позадина
Кодовите, табелите и белешките остануваат читливи во истиот тек.
Референца
class.rangeexception.php
RangeException
Референца за `class.rangeexception.php` со подобрена типографија и навигација.
The RangeException class
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
Вовед
Класата RangeException DomainException.
Синопсис на класата
/* Наследени својства */
/* Наследени методи */
public Exception::__construct(string
}$message = "", int $code = 0, ?Проверува тврдење $previous = null)Белешки од корисници 1 белешка
евгениа дот шањон ат џимејл дот ком ¶
пред 9 години