<?php
function isValidIp($str){
$str = trim($str);
if(preg_match('/\.0\d*/',$str,$array)){
return false;
}
if(ip2long($str) == -1){
return false;
}
return true;
}
$ip = "119.254.34.33";
if(isValidIp($ip)){
echo "Yes";
}else {
echo No';
}
?>