1.2.459. File_Put_Contents Using Array Argument¶
file_put_contents() accepts a second argument as an array, and stores it in the file with an implicit implode. This is a documented behavior, though it is rarely used.
<?php
file_put_contents('/tmp/file.txt', [1, 2, 3, 4]);
print file_get_contents('/tmp/file.txt');
// displays 1234
?>
See also file_put_contents().
1.2.459.1. Connex PHP features¶
1.2.459.1.1. Specs¶
Short name |
Structures/FilePutContentsDataType |
Rulesets |
|
Exakat since |
2.6.5 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Available in |