I've written some code to generate a "he said she said etc" forum sig from text files. But after every variable there is a funny symbol. Any one have any ideas what they are and how to get rid of them? (the funny 'vt' one)

link to the problem here:

    <?php
    $file = "1.txt";
    $contents = file($file);
    $read1     = mt_rand(0,(count($contents)-1));
    $line1 = $contents[$read1];
    
    $file = "2.txt";
    $contents = file($file);
    $read2     = mt_rand(0,(count($contents)-1));
    $line2 = $contents[$read2];
    
    $file = "3.txt";
    $contents = file($file);
    $read3     = mt_rand(0,(count($contents)-1));
    $line3 = $contents[$read3];
    
    $file = "4.txt";
    $contents = file($file);
    $read4     = mt_rand(0,(count($contents)-1));
    $line4 = $contents[$read4];
    
    $file = "5.txt";
    $contents = file($file);
    $read5     = mt_rand(0,(count($contents)-1));
    $line5 = $contents[$read5];
    
    $file = "6.txt";
    $contents = file($file);
    $read6     = mt_rand(0,(count($contents)-1));
    $line6 = $contents[$read6];
    
    $file = "7.txt";
    $contents = file($file);
    $read7     = mt_rand(0,(count($contents)-1));
    $line7 = $contents[$read7];
    
    $file = "8.txt";
    $contents = file($file);
    $read8     = mt_rand(0,(count($contents)-1));
    $line8 = $contents[$read8];
    
    $height = 75;
    $width = 300;
    $im = ImageCreate($width, $height);
    $txt = ImageColorAllocate ($im, 0, 0, 0);
    $bg = ImageColorAllocate ($im, 150, 203, 0);
    ImageFill($im, 0, 0, $bg);
    
    $text = $line1." met ".$line2." ".$line3;
    ImageString($im, 2, 5, 2, "$text",   $txt);
    ImageString($im, 2, 5, 13, "$line4", $txt);
    ImageString($im, 2, 5, 24, "$line5", $txt);
    ImageString($im, 2, 5, 35, "$line6", $txt);
    ImageString($im, 2, 5, 46, "$line7", $txt);
    ImageString($im, 2, 5, 57, "$line8", $txt);
    
    header ('Content-type: image/png');
    ImagePng ($im);
    ImageDestroy($im);
    ?> 
    

      It seems like he is reading ; strange do you have in .tzt files ;

        Worked out the symbols symbolise the return charachter. The only one not displaying the symbol is the one at the end of the file.

        Does any one know how to correct this? I am running out of ideas.

          str_replace( "\n", "", $string);
          should work, right?

          edit:
          if that doesnt work, this may
          $string = substr($string, 0, -2);

          edit again:
          just do what the person below me says =D

            or
            $string = trim($string);

              Write a Reply...