Re: making an array from data in textfile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



OK, well I did a debug and this is whats coming out:

Array
(
   [0] => 127.0.0.1,127.0.0.1,127.0.0.1
)

Should I use fgets?

On 7/22/06, Dave W <dabbaking@xxxxxxxxx> wrote:

OK, so I have this text file that holds a list of ip addresses like this:
127.0.0.1,127.0.0.1,127.0.0.1, 127.0.0.1,127.0.0.1

Currently, here is my code:

    $file = 'ip.txt';
    $fh = fopen($file, 'r');
$theData = fread($fh, filesize($file));
fclose($fh);
$ips = array($theData);

Since it's a numeric array, I shouldn't need quotes around the ip octets.
When I try to echo certain parts of the array like:

echo $ips[0];

It's returning the whole array. The text file is exactly like an array so
it shouldn't be a problem.



--
Dave W




--
Dave W

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux