making an array from data in textfile

From: Date: Sun, 23 Jul 2006 01:31:35 +0000
Subject: making an array from data in textfile
Groups: php.db 
Request: Send a blank email to php-db+get-42245@lists.php.net to get a copy of this message
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

« previous php.db (#42245) next »