0 Maiya posted Best way to split a first and last name in PHP $name="maiiya chandra"; echo $firstname; echo $lastname; how to divide the string some how i get the first and last name in php Edit Question
0 jessica answered Jul 17 '21 00:00 explode string with space and you will get array with two value one is the firstname and lastname $name="maiiya chandra"; $name_array=explode(" ",$name); $firstname=$name_array[0]; $lastname=$name_array[1]; echo "firstname is ".$firstname; echo "lastname is ".$lastname; Edit Answer