first question answered very quickly, thanks to all.
here is the issue, for a given string..
$str= "name1 surname2, name2 midname2 surname2";
to make things more clear, there is two persons, one has two values(name, surname) while other has midname too. so, I want to get all them separate while knowing which name belongs to which person, like;
foreach ($persons as person){
if( person has midname){
$value1 ="name"; $value2= "midname"; $value3="surname"}
else
$value1="name"; $value2="surname"
}
1 Answer