note 65523 added to function.delete

From: Date: Tue, 02 May 2006 18:44:41 +0000
Subject: note 65523 added to function.delete
Groups: php.notes 
Request: Send a blank email to php-notes+get-110383@lists.php.net to get a copy of this message
function delete ($file, $ext) { //provide name and extension if (file_exists($file.'.'.$ext)) { //checking if the file exists unlink($file.'.'.$ext); } //delete the file else echo "File <b>$file</b> not found"; //print out the error } //usage of the function delete //You dont have to check if the file you want to delete exists, //its automatically done within the function $something = 1 if ($something == 1) delete ('somefile', 'php'); else exit($something.' is false'); /*comments : the $ext variable is not needed, but it's useful when you are dealing with a lot of different extensions, for example:*/ $php = 'php'; //NO dots!! $html = 'html'; if ($something == 1) delete ('somefile', $php); else delete ('someotherfile', $html); ---- Server IP: 195.184.96.15 Probable Submitter: 85.218.140.101 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.delete.php Edit -- http://master.php.net/note/edit/65523 Del: integrated -- http://master.php.net/note/delete/65523/integrated Del: useless -- http://master.php.net/note/delete/65523/useless Del: bad code -- http://master.php.net/note/delete/65523/bad+code Del: spam -- http://master.php.net/note/delete/65523/spam Del: non-english -- http://master.php.net/note/delete/65523/non-english Del: in docs -- http://master.php.net/note/delete/65523/in+docs Del: other reasons-- http://master.php.net/note/delete/65523 Reject -- http://master.php.net/note/reject/65523 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#110383) next »