It might be a bit easier if you used a database. For example, in MySQL you could simply use the following query:
SELECT score FROM scores ORDER BY score DESC LIMIT 0, 10
If you must use a .dat file,I would use the fread(), fopen(), fwrite() PHP functions to append a delimited line to your file each time:
So your file looks like:
100|David
77|Joe
I don't want to develop this ;-) and I would use a database personally, but you might be able to split() the contents of the .dat file into an array by a line break (\n) and then maybe use sort() to order your array (allthough I believe that one sorts from lowest to highest). Then I would iterate through the array 10 times, to print out the results. However, in this case 100 is lower than 77 because 1 comes before 7. Anyways, maybe this points you in the right direction...and then again, maybe not! ;-)