← All built-ins / touch()

touch()

touch(string $s): bool

Parameters

NameTypeDescription
$pathstringfile path

Return value

true; creates the file when missing.

Example

touch("/tmp/hphp_doc_t.txt");
var_dump(file_exists("/tmp/hphp_doc_t.txt"));
unlink("/tmp/hphp_doc_t.txt");
bool(true)

See also

file_exists()fopen()