I'm trying to delete the email from a comma separated string. I have a script that brings me emails. Any way to do this quickly:
$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;
}
}
Result:
array(Example1@email.com,Example3@email2.com);
But I need:
string "0001,00005,0010,003"