file() creates the array based on 'new line' characters (\n).  If no line
breaks are present then it will create an array with one element and that
element will be entire file.  What exactly does this list.txt file look
like?

- Kevin


----- Original Message -----
From: "Pushpinder Singh Garcha" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 24, 2003 1:41 PM
Subject: [PHP] File Trouble


Hello All

I am trying to load the contents of a file stored on the server in to
an array. The file has 125 or so lines. However when I load the file
into the array and try to print the array elements..all I see is one
continuos line.


    $PASSPORT_CODES=file("../GUEST/list.txt");

    if(!$PASSPORT_CODES)
    {
      echo "File could not be read by the system !! <br>";
      exit;
    }
    else
    echo "File was opened !!<br>";

    $x = count($PASSPORT_CODES);
    echo "Count is : $x<br>";

    for($i=0; $i<count($PASSPORT_CODES); $i++){
   echo "$PASSPORT_CODES[$i]";
   echo "<br>";
    }


Can you please help me out with this....  I need to get a 125 element
array...so that my code can check the individual elements of the Array.
Thanks in advance

Pushpinder Singh Garcha
_________________________________
Web Architect




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to