note 111425 added to function.delete
| From: | YousefIsmaeilCliprz | Date: | Tue, 19 Feb 2013 07:30:56 +0000 |
| Subject: | note 111425 added to function.delete | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-193678@lists.php.net to get a copy of this message | ||
If you use this function you will get a error :
Fatal error: Call to undefined function delete();
so this not problem you can use unlink() function :
unlink();
Or create a new user function by using :
1 - function_exists();
2 - file_exists();
3 - unlink();
as in example you can use :
<?php
if (!function_exists('delete'))
{
/**
* Delete a file.
*
* @param (string) $filename - File name with path if exists.
* @author Yousef Ismaeil Cliprz.
*/
function delete($filename)
{
if (file_exists($filename))
{
return (bool) ((unlink($filename)) ? true : false);
}
else
{
return false;
}
}
}
// Use
if (delete('FileNameHere.php'))
{
echo 'File was deleted';
}
else
{
echo 'Some errors here ....';
}
?>
----
Server IP: 69.147.83.199
Probable Submitter: 31.214.51.92
----
Manual Page -- http://php.net/manual/en/function.delete.php
Edit -- https://master.php.net/note/edit/111425
Del: integrated -- https://master.php.net/note/delete/111425/integrated
Del: useless -- https://master.php.net/note/delete/111425/useless
Del: bad code -- https://master.php.net/note/delete/111425/bad+code
Del: spam -- https://master.php.net/note/delete/111425/spam
Del: non-english -- https://master.php.net/note/delete/111425/non-english
Del: in docs -- https://master.php.net/note/delete/111425/in+docs
Del: other reasons-- https://master.php.net/note/delete/111425
Reject -- https://master.php.net/note/reject/111425
Search -- https://master.php.net/manage/user-notes.php