我正在尝试从逗号分隔的字符串中删除电子邮件。我有一个给我带来电子邮件的脚本。任何快速做到这一点的方法:
$cadena = "Example1@email.com,0001,00005,0010,Example3@email2.com,003";
$cadena = explode(",", $cadena);
foreach($cadena as $res){
if(filter_var($res, FILTER_VALIDATE_EMAIL)){
$result[] = $res;
}
}
结果:
array(Example1@email.com,Example3@email2.com);
但是我需要:
string "0001,00005,0010,003"