I have an IP address and I’m given two other IP addresses which together creates an IP range. I want to check if the first IP address is within this range. How can i find that out in PHP?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
With
ip2long()it’s easy to convert your addresses to numbers. After this, you just have to check if the number is in range: