Jump to content

Ranking elements in txt file


Scummy12

Recommended Posts

suppose your file is called test.txt and in the same directory as the script and also just a comma seperated list of numbers

$file="test.txt";
$f=fopen($file, "r");
$content=fread($f,filesize($file));
fclose($f);
$del=",";
$s=explode($del, $content);
rsort($s);
echo $s[0]."<br/>".$s[1]."<br/>".$s[2];

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.