fwrite() expects parameter 2 to be string, array given

The solution for “fwrite() expects parameter 2 to be string, array given” can be found here. The following code will assist you in solving the problem.

//If you explicit need to put array in file you can do it with this

fwrite($handle, print_r($result, true));
//or you can convert it to json, like this

fwrite($handle, json_encode($result));
//And later when you read the file you can just undo the action with
//json_decode($your_file_content)

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in