I would like to change the order of names from Last, First to First Last. I don't know the REGEXP and the php syntax for it.
views:
54answers:
3
+3
A:
You could just use:
$name = "Lastname, Firstname";
$names = explode(", ", $name);
$name = $names[1] . " " . $names[0];
Lex
2010-04-15 13:56:28
To a noobie, something that works seems like magic. Thanks!
ggg
2010-04-15 15:13:14
A:
I hate regular expressions.. You could always do something like
implode(' ',array_reverse(explode(' ,',$string)))
But I'm probably only suggesting that because it's the more intuitive way in Ruby, which I've recently dropped php for :)
Jeriko
2010-04-15 13:59:09