Quick Question
Posted: Mon Feb 04, 2008 3:45 pm
Alright, I've been coding PHP for about 2 years now, but I have this one question that I can't seem to find the answer to.
I'm creating this program that turns an IP into binary, but I'm running into this small issue.
Right now, I have to create 4 seperate text boxes for a user to input the IP address in, but I would just prefer the user to use 1 textbox and put in the whole IP. This leads me to my question.
An IP is 4 sets of numbers with periods in between., ex 11.222.33.44. I want to be able to turn this IP address into 4 variables holding the int, like this:
$ip1="11";
$ip2="222";
$ip3="33";
$ip4="44";
Now, I am NOT looking for a code that will get rid of the "." and just give me "112223344".
Is there a code that is capable of doing this?
I'm creating this program that turns an IP into binary, but I'm running into this small issue.
Right now, I have to create 4 seperate text boxes for a user to input the IP address in, but I would just prefer the user to use 1 textbox and put in the whole IP. This leads me to my question.
An IP is 4 sets of numbers with periods in between., ex 11.222.33.44. I want to be able to turn this IP address into 4 variables holding the int, like this:
$ip1="11";
$ip2="222";
$ip3="33";
$ip4="44";
Now, I am NOT looking for a code that will get rid of the "." and just give me "112223344".
Is there a code that is capable of doing this?