----- Original Message ----- From: "Clark" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, February 17, 2002 3:15 AM Subject: [PHP] storing arrays
> Two questions: > > 1) Is it possible to write an array to a file? not direct, use: $fp = fopen("/my/file", "w"); foreach($filearray as $row) fputs($fp, $row."\n"); fclose($fp); > 2) Is it possible to specify the name of the key to each item of an > array when you get the array using file(). not direct, use: $keys = array("first", "second", "third", "fourht"); $filearray = file("/my/file"); for($x = 0; $x < count($filearray); $x++) $newfilearray[$keys[$x]] = $filearray[$x]; $filearray = $newfilearray; i think only a write version of file could be a useful function for php... mvgr, Joffrey van Wageningen -- .-[ Joffrey van Wageningen | WoLFjuh | [EMAIL PROTECTED] ]-------------- | Networking Event 2000 - www.ne2000.nl - IRCnet:#ne2000, Undernet:#clue | PGP:1024D/C6BA5863 - 3B93 52D3 CB91 9CB7 C50D FA79 865F 628A C6BA 5863 | * We demand guaranteed rigidly defined areas of doubt and uncertainty. | -- Douglas Adams -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php