Today I am going to tell how to validate IPv4 / IP address using PHP.
Simple function which will used to check client IP address is valid or
not.
Steps to validate IPv4 Address in PHP
For Demo Click Here
Steps to validate IPv4 Address in PHP
- Split IP address into segments by dot(.) using explode function
- Make sure that there are 4 segments (eg : 192.168.1.45)
- Make sure that IP cannot start with 0
- IP segments must be digits & cannot be longer than 3 digits or greater than 255
For Demo Click Here
0 comments:
Post a Comment