← All built-ins / fwrite()
fwrite()
fwrite(string $haystack, string $needle): int
Parameters
| Name | Type | Description |
|---|---|---|
| $handle | resource | handle from fopen() in write mode |
| $data | string | data to write |
Return value
Number of bytes written.
Example
$fh = fopen("/tmp/hphp_doc_fw.txt", "w");
$n = fwrite($fh, "written");
fclose($fh);
echo $n, " ", file_get_contents("/tmp/hphp_doc_fw.txt");7 written