Jump to content

fgets returning 1 byte


BBGaming

Recommended Posts

for($i=0;$i<=9;$i++)
{
$file=fopen("action/" . $i . ".html","r");
$score[$i]=fgets($file);
echo($score[$i] . "<br>");
$name[$i]=fgets($file);
echo($name[$i] . "<br>");
fclose($file);
}

This code it only returning the first byte of each score (number). The file looks like this:

500000
Steve Johnson

No matter what I change the number to, it only returns the first byte. But the weird thing is, it returns all of the name. I'm confused. I tried adding a byte count argument to the fgets(), but it still didn't help.

Link to comment
https://forums.phpfreaks.com/topic/162416-fgets-returning-1-byte/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.