As many recommend me to separate firstname and lastname instead of "full_name" with everything in, how can I separate them to each variables, so if for you example type in the field: "Dude Jackson" then "Dude" gets in $firstname and Jackson in the $lastname.
7条回答 默认 最新
doucitan2544 2010-09-14 11:44关注Assuming first name always comes first and there's no middle name:
list($firstname, $lastname) = explode(' ', $full_name);This simply explodes
$full_nameinto an array containing two strings if they're separated by only one space, and maps them to the first and last name variables respectively.本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报