Ok i want this

<?php

$fp = fopen("http://cerberus.vpsland.com/Highscore.txt", "r");
$data = "";

while(!feof($fp))
{
$data .= fgets($fp, 4096);
}

echo $data;

?>

which displays Highscore.txt to ignore "-" and "|" and list the people like

  1. MantleRage 1485
  2. Name Score
    and so on

    Is Highscore.txt a file you generate? If so, why not delimit the data like so:

    name,score
    name,score
    name,score
    ...

    Then, you could use file() to retrieve all the data and explode each element back into name and score.

    If you aren't generating this file, give us a few sample lines so we can better help you parse it out.

      $file = file("filename.ext");
      
      foreach( $file as $line ) {
         $data = explode(",", $line);
         echo "Name: $data[0], Score: $data[1]<br />";
      }
      

      That is, if your data is stored like this:

      name,score
      name,score
      name,score
      ...

        Ah thats cool but i cant change the way the data's stored and its like this

        MantleRage-1485|Redemption-1436|Ansem-1340|starr-1253|Sid-1199|Mephisto-1194|DragoonNessX-1114|AlphaPk-1072|Shade-1004|UnderTheMoon-1001|

          MantleRage-1485|Redemption-1436|Ansem-1340|starr-1253|Sid-1199|Mephisto-1194|DragoonNessX-1114|AlphaPk-1072|Shade-1004|UnderTheMoon-1001|

          Similarly,

          
          $file = file("filename.ext");
          
          $data = explode("|", $file[0]);
          
          foreach( $data as $this_data ) {
             $player = explode("-", $this_data);
             echo "Name: $player[0], Score: $player[1]<br />";
          }
          
          

            Excellent ill try this now a+++ even if it doesnt work fopr the attempt

              foreach( $data as $key => $this_data ) {
                 if ($key < 10)
              {
              $player = explode("-", $this_data);
                 echo "Name: $player[0], Score: $player[1]<br />";
              }
              } 
              

                It's coming up with 11 because you have an unnecessary delimiter | at the end of the data.

                  Write a Reply...