2024-09-27 15:32:22 -04:00

20 lines
476 B
PHP

<?php
if (!function_exists('is_digit')) {
/**
* Deal with normal (and irritating) PHP behavior to determine if
* a value is a non-float positive integer.
*/
function is_digit(mixed $value): bool
{
return !is_bool($value) && ctype_digit(strval($value));
}
}
if (!function_exists('is_ip')) {
function is_ip(?string $address): bool
{
return $address !== null && filter_var($address, FILTER_VALIDATE_IP) !== false;
}
}