Function __global->file_put_contents
Definitions
sources_custom/phpstub.php
- Write a string to a file.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $filename | PATH | No | No | required parameter | N/A | N/A | Path to the file where to write the data |
| $data | string | No | No | required parameter | N/A | N/A | The data to write |
| $flags | integer | No | No | 0 | N/A | N/A | Supported flags |
| $context | ?resource | No | No | Null | N/A | N/A | A stream context to attach to (null: no special context) |
Returns
- Bytes written (false: error)
- Type: ~integer
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Write a string to a file.
*
* @param PATH $filename Path to the file where to write the data
* @param string $data The data to write
* @param integer $flags Supported flags
* @param ?resource $context A stream context to attach to (null: no special context)
* @return ~integer Bytes written (false: error)
*/
function file_put_contents(string $filename, string $data, int $flags = 0, $context = null)
* Write a string to a file.
*
* @param PATH $filename Path to the file where to write the data
* @param string $data The data to write
* @param integer $flags Supported flags
* @param ?resource $context A stream context to attach to (null: no special context)
* @return ~integer Bytes written (false: error)
*/
function file_put_contents(string $filename, string $data, int $flags = 0, $context = null)

