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 :
johnlucio

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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Cornelia YoderArtistCommented:
$name=strtolower("Lucio, John");

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

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dr_dedoCommented:

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

Open in new window

0
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 :))
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.