Hi
I'm trying to split a string by comma and semi-colon. Currently I do it like this...
$str = "mail@example.com, mail1@example.com; mail2@example.com;mail3@example.com,";
$mails = preg_split("/;/", $str);
foreach ($mails as $mail){
$temp_mail = preg_split("/,/", $mail);
if($temp_mail){
foreach ($temp_mail as $temp_m){
echo $temp_m . "<br>";
}
} else {
echo $mail;
}
}
It works, but is obviously not elegant at all. Is there a way to tell preg_split to split either by comma OR semi-colon? I've played around but haven't figured out how.
Thanks a lot.
H