← All built-ins / file_exists()
file_exists()
file_exists(string $s): bool
Parameters
| Name | Type | Description |
|---|---|---|
| $path | string | file or directory path |
Return value
true when the path exists.
Example
file_put_contents("/tmp/hphp_doc_e.txt", "x");
var_dump(file_exists("/tmp/hphp_doc_e.txt"));
var_dump(file_exists("/tmp/hphp_doc_missing.xyz"));
unlink("/tmp/hphp_doc_e.txt");bool(true) bool(false)