Web Service
[PHP] IP체크 정규식
vencedor
2016. 7. 12. 22:00
IP유효성 체크
function checkIPAddr($ip){ $result = 0; if (preg_match('/^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/',$ip)){ $result = 1; } return $result; } $test = checkIPAddr('1.1.1.1') echo $test