You can use the PHP code below to check if an IP address is valid or not.
1
2
3
4
5
6
|
$ip = ""; //enter a valid or invalid ip address here
if(filter_var($ip, FILTER_VALIDATE_IP)) {
// The IP Address is valid
} else {
// The IP Address is not valid
}
|
Wasn’t that easy!?!