Ip Check Using PHP

If you have ever had the need to validate an IP address then this small script is for you.

 

Ok, that’s all fine and dandy but what does it mean?

The fist if the statement is breaking the IP up into 3 sections and removing the ‘.’ from the user input. It then stores the results in the $part var then the second If statement checks to see if all of the parts are valid. If everything is fine and dandy it will return TRUE and if something has gone wrong it will return FALSE.
Hope this helps anyone.