« on: June 11, 2021, 01:37:53 PM »
from:
https://www.justinsilver.com/technology/writing-to-the-php-error_log-with-var_dump-and-print_r/function var_error_log( $object=null ){
ob_start(); // start buffer capture
var_dump( $object ); // dump the values
$contents = ob_get_contents(); // put the buffer into a variable
ob_end_clean(); // end capture
error_log( $contents ); // log contents of the result of var_dump( $object )
}
$object = $variableToLog;
var_error_log( $object );
or to a file ...
ob_flush();
ob_start();
var_dump($variableToLog);
file_put_contents("dump.txt", ob_get_flush());
« Last Edit: June 26, 2021, 05:34:18 PM by Chip »
No reactions
No reactions
No reactions
No reactions
No reactions
No reactions
No reactions