I need to split a IP address in to 4 different vars.
How can I do something like that.
ip[0] = "196"; ip[1] = "6";
etc.?
Thank you
list($one, $two, $three, $four) = explode("." $ip);
Explode will return an array of values found in the string separated by the separator you pass. List acts like an array but puts the values into separate variables.
I have tried this solution with date... this is the line I am using $date = date("F/Y"); list($one, $two) = explode("/" $date); echo("$one<BR>$two");
I am getting a parse error on line 3 (list($one, $two) = explode("/" $date)😉
You need a comma in the call to explode. You are passing the function 2 arguments, and in PHP all arguments passed need to be separated by comma's.
list($one, $two) = explode("/", $date);
Sorry I guess I left it out in my example. ;->