← All built-ins / is_file()

is_file()

is_file(string $s): bool

Parameters

NameTypeDescription
$pathstringpath to test

Return value

true when the path is an existing regular file.

Example

file_put_contents("/tmp/hphp_doc_f.txt", "x");
var_dump(is_file("/tmp/hphp_doc_f.txt"));
var_dump(is_file("/tmp"));
unlink("/tmp/hphp_doc_f.txt");
bool(true)
bool(false)

See also

is_dir()file_exists()