Hey all. I need to create an array of first names from another array of first and last names. So basically the original array with first and last names looks like this:
Original Array
array("John Doe", "Jane Doe", "John Darling", "Jane Darling");
And the array I need to create from that would be:
New Array
array("John", "Jane", "John", "Jane");
So I guess for each value I would need to remove whatever comes after the space. If someone can point me in the correct direction to use regular expressions or some array function that would be great.
Cheers!
Update:
Thank you all for your answers.
this should do the trick, and if it shouldn’t I’m really sorry but haven’t slept this night :P, but you’ll get the idea 😉