programming faqs interview questions tech technical educational freshers guide preparation interviews hr telephonic
try another color:
try another fontsize: 60% 70% 80% 90%
Programming FAQs

How to validate ip address in php

Average: 5 (1 vote)

we can validate ip using

we can validate ip using ip2long function in php

eg:
$ip = '10.10.23.456'
$long = ip2long($ip);
if ($long == -1 || $long === FALSE) {
echo 'Invalid IP, please try again';
} else {
echo "valid ip"
}