I want to take a user name ie Danny Marks
and split it into 2 seperate words Danny & Marks and put them into two diffrent vars
Help Please thaks
Richie TM
Good thing to do is check manual for array functions...
$name="Danny Marks"; $name=explode(" ", $name);
After that $name[0] will be Danny and $name[1] will be Marks...
If you don't like use array elements as vars then re-assign them.
Di
Don't forget to trim the leading and trailing whitespace that might be there if your input is a variable
$name = " Danny Marks " $name = trim($name); $name = explode(" ", $name); echo $name[1]; //Danny echo $name[2]; //Marks
er oops $name[0]; //Danny $name[1]; //Marks