Re: Is there a better way to do this

From: Date: Wed, 16 May 2001 21:42:34 +0000
Subject: Re: Is there a better way to do this
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-53110@lists.php.net to get a copy of this message
on 5/16/01 5:10 PM, Richard Kurth at rkurth@pacifier.com wrote: > Is there a better way to do this I want it to look and see if the > userdata file is there and if true the bypass everything else run rest > of code. If is not then check to see if userdat1 is and if it is > change it's name to userdata the run rest of code. If none of the are > there then gust shut down. > > > if(file_exists("userdata")) { > end; > } elseif(file_exists("userdata1")) { > copy('userdata1','userdata') ; > system("rm userdata1"); > end; > } else { > exit; > } > > > < rest of code> if (!file_exists("userfile")) { if (file_exists("userdata1") { unlink("userfile1"); } else { exit; } } is a bit cleaner. I'd use unlink("userfile1") rather than system("rm userfile1") just to be pretty. -- /chris/

« previous php.general (#53110) next »