ok so i have a user field that has the user enter the full name and i need to flip the names around
$pieces = explode(" ", $_POST['realname']);
name = stripslashes($pieces[1] . "-" . $pieces[0]);
but the problem is that if they type in the field
i need the final output as jones-mark for sake of the requirements or if there is only m开发者_运维知识库ark then i need mark
mark jones
all is well but if they type
mark
then the output is
-mark
im sure there is a better way to do this
implode("-",array_reverse($pieces))
精彩评论