This logic solution to problem checking dns reverse name resolution:
<?php
$ip = gethostbyname($host);
if(ip2long($ip) == -1 || ($ip == gethostbyaddr($ip) && preg_match("/.*\.[a-zA-Z]{2,3}$/",$host) == 0) ) {
echo 'Error, incorrect host or ip';
}
else {
echo 'Ok';
}
?>