Return to Snippet

Revision: 66031
at March 1, 2014 22:25 by manishwebginger


Initial Code
<?php
$ip_address = '127.0.0.1';
 
if(preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $ip_address)){
   echo 'IP address is valid!';
}else{
   echo 'IP address is NOT valid!';
}

Initial URL

                                

Initial Description
php

Initial Title
How to Validate IP Address in PHP

Initial Tags
php

Initial Language
PHP