I have a .txt list with a large number of birthdays, in a format like this:
1975-12-13|Amy Lee|amylee@gmail.com
I would like to create php code that would go through the whole list, find persons who have a birthday today, and list their names.
What I manage to do is this, but it is showing only one name, even tho there's multiple birthdays at the same day:
$f=file('birthday.txt');
$today=date('m-d');
for ($i=0; $i<count($f); $i++) {
$info=explode ('|',$f[$i]);
if (substr($info[0],5)==$today) {
$firstlastname= $info[1];
$message=''.$firstlastname.'';
}
}
return ''.$message.'';
I guess that I should use foreach there somehow, I'm not a pro in PHP obviously, but I don't know how to do that. Any suggestions please?
Thanks!