troubleshooting Question

parse ' ' and ',' to make names

Avatar of rgb192
rgb192Flag for United States of America asked on
PHPRegular Expressions
5 Comments1 Solution200 ViewsLast Modified:
parse firstname lastname by ' '(space)
 
$name="Peter L. Panda";

$temp=explode(" ",$name,2);
$firstname=$temp[0]; //==Peter
$lastname=$temp[1]; //==L. Panda


but if name contains a ',' (comma)

last_name,first_name  where last_name is the first word

smith, john
first=john
last=smith

jones, john L
first=john L
last=jones

evans, mary lee
first= mary lee
last=evans
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros