Sometimes it happen you need to get a array to a file in PHP. For example if you use REST or JSON and need to get the server requests. One way to write the request in to a log or file. To do so, you can write a function which read the array and write it line per line to the file. Or ? You use native php functions like the Output Control Functions. If you want to get the output of a var_dump, the code could look like this:
ob_start ();
var_dump($_REQUEST);
$text = ob_get_contents();
ob_end_clean();
file_put_contents("data".date('Ymd-His').".txt",$text);