Re: create textfile if not existing?

From: Date: Mon, 29 Apr 2002 21:00:30 +0000
Subject: Re: create textfile if not existing?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-95264@lists.php.net to get a copy of this message
This works but the "w" means that it writes over whats already in the file (look at the manual about fopen for more details) $new_file = "txt/whatever.txt"; $fh = fopen($new_file , "w"); // write the changed new file fputs ($fh, $new_code); // now close the file fclose($fh); Regards John > lets say I have 30 lines of text and I want to store it in a folder called > "txt" with the filename $name.txt and, if $name.txt exists, create a > $name1.txt or similiar? > > Håkan > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#95264) next »