Hi,
I want to get each line of e-mail accounts from my txt file and put
them in an array after checking the syntax.
I made a few tries but can't accomplish on that here is my text file
look like:
mails.txt
he@yourdomain.c om
she@yourdomain. com
me@yourdomain.c om
you@yourdomain. com
And here is my code:
<?
$filename = file("mails.txt ");
foreach($filena me as $line){
$syntax_ok_emai ls =
preg_match('/^[A-z0-9_\-]+\@(A-z0-9_-]+\.)+[A-z]{2,4}$/', $line);
if($syntax_ok_e mails){
$e_mails[] = $syntax_ok_emai ls;
}
}
foreach($e_mail s[] as $value){
echo $value;
}
?>
I want to get each line of e-mail accounts from my txt file and put
them in an array after checking the syntax.
I made a few tries but can't accomplish on that here is my text file
look like:
mails.txt
he@yourdomain.c om
she@yourdomain. com
me@yourdomain.c om
you@yourdomain. com
And here is my code:
<?
$filename = file("mails.txt ");
foreach($filena me as $line){
$syntax_ok_emai ls =
preg_match('/^[A-z0-9_\-]+\@(A-z0-9_-]+\.)+[A-z]{2,4}$/', $line);
if($syntax_ok_e mails){
$e_mails[] = $syntax_ok_emai ls;
}
}
foreach($e_mail s[] as $value){
echo $value;
}
?>
Comment