public static function Helper::cidr__validate in Anti Spam by CleanTalk 8.4
Same name and namespace in other branches
- 9.1.x src/lib/Cleantalk/Common/Helper.php \Cleantalk\Common\Helper::cidr__validate()
Validate CIDR
Parameters
string $cidr expects string like 1.1.1.1/32:
Return value
bool
1 call to Helper::cidr__validate()
- Helper::ip__mask_match in src/
lib/ Cleantalk/ Common/ Helper.php - * Check if the IP belong to mask. Recursive. * Octet by octet for IPv4 * Hextet by hextet for IPv6 * *
File
- src/
lib/ Cleantalk/ Common/ Helper.php, line 389
Class
- Helper
- CleanTalk Helper class. Compatible with any CMS.
Namespace
Cleantalk\CommonCode
public static function cidr__validate($cidr) {
$cidr = explode('/', $cidr);
return isset($cidr[0], $cidr[1]) && self::ip__validate($cidr[0]) && preg_match('@\\d{1,2}@', $cidr[1]);
}