Trying to understand php and having a hard time. Looking for help to understand what I am doing wrong with a program
I'm not looking for someone to do it for me. I want to know what I am doing wrong so really just looking for someone to talk it through with me.
$telephonelist = fopen("recordsdirectory.txt","a+");
if (filesize ("recordsdirectory.txt")<=0)
{
echo "empty";
exit (0);
}
$contents = fread($telephonelist, filesize("recordsdirectory.txt"));
$newlistArray = explode(",",$contents);
foreach ($newlistArray as $telephonelist)
$list=array("$lastname" and "$firstname"=>"$areacode"and"$phonenumber");
{
echo "$list";
}
fclose($telephonelist);
I'm not looking for someone to do it for me. I want to know what I am doing wrong so really just looking for someone to talk it through with me.
$telephonelist = fopen("recordsdirectory.txt","a+");
if (filesize ("recordsdirectory.txt")<=0)
{
echo "empty";
exit (0);
}
$contents = fread($telephonelist, filesize("recordsdirectory.txt"));
$newlistArray = explode(",",$contents);
foreach ($newlistArray as $telephonelist)
$list=array("$lastname" and "$firstname"=>"$areacode"and"$phonenumber");
{
echo "$list";
}
fclose($telephonelist);