Parsing data

there is a field in my DB that contains the name of a person in this format : Lucio, John

When this $name variable is returned, it looks like this :
Lucio, John
I need to make a new variable with it that will look like this :

in other words, I need to remove the capital letters, I also need to remove the comma and inverse the first name and last name.

Is that feasable?
John AccountAsked:
Who is Participating?
Cornelia YoderConnect With a Mentor ArtistCommented:
$name=strtolower("Lucio, John");

$namearray=explode(", ",$name);

$newname = $namearray[1].$namearray[0];

$x =  'Lucio, John';
$x = explode(',',strtolower($x));
$x = trim($x[1].$x[0]);
echo $x;

Open in new window

Cornelia YoderArtistCommented:
Hi JohnLucio, thank you for the points, but for the future, you should share the points between two correct, essentially simultaneous answers.  It's fair and it keeps people from rushing off a fast barely adequate answer just to be first :))
All Courses

From novice to tech pro — start learning today.