note 91363 deleted from function.fopen by cmb
| From: | cmb@php.net | Date: | Fri, 09 Sep 2016 22:32:22 +0000 |
| Subject: | note 91363 deleted from function.fopen by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-206547@lists.php.net to get a copy of this message | ||
Note Submitter: gmdebby at gmail dot com
----
I was wondering why was added the "x" mode, it works only if the file do not exists, will
create it and open it in read only, it's useless !!
But I found something I could do with that.
Here is a little mk_file function.
<?php
function mk_file($filename) {
if(!is_file($filename)) {
fclose(fopen($filename,"x")); //create the file and close it
return true;
} else return false; //file already exists
}
?>
You can improve it, add chmod support etc...