Array Creation

From: Date: Wed, 09 Jan 2002 20:34:33 +0000
Subject: Array Creation
Groups: php.general 
Request: Send a blank email to php-general+get-79952@lists.php.net to get a copy of this message
What I have is a text file that has data in the following format: "username, numbers" The quotation markes can't be helped...the script I use to generate the file adds them automatically. (Hummingbird Basic, one of the worst languages in the history of mankind.) What I've been trying to do is create an array from the file with the following format: array (username=>numbers) I have gotten this far: while (!feof ($fp)) { $line = fgets($fp, 4096); $data = explode(",", str_replace("\"", "", $line)); //using str_replace to get rid of quote marks //following line to see if data is correct echo $data[0]." ".$data[1]."<br>"; } fclose($fp); The data is right, however I can't seem to build an array dynamically. Also, please let me know if I can do this more efficiently. Thanks. NOTE: Using php 4.0.6, so the function trim($line, "\"") did not work ********************************************** Jamison R. Website: http://www.nuitari.com ICQ: 2375136 MSN Messenger: einstruzende at hotmail.com **********************************************

« previous php.general (#79952) next »