20
Nov '11

Write a var_dump to a File with PHP

Using the output buffer to grab the var_dump output

ob_start();

var_dump($_REQUEST);

if ($handle = fopen("/tmp/error.log", "w")) {
	fwrite($handle, ob_get_contents());
}

fclose($handle);
ob_end_clean();

Leave a Reply