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?
Quick Question
Moderator: General Moderators
Quick Question
Last edited by Zanne on Mon Feb 04, 2008 3:50 pm, edited 1 time in total.
Re: Quick Question
Code: Select all
$array = explode('.', $ip);Re: Quick Question
explode() ?
http://us.php.net/explode
http://us.php.net/explode
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: Quick Question
Moved to PHP - Code.
Re: Quick Question
Thank you all very much. The code works fine =)
God bless,
Zanne
God bless,
Zanne