Possible Duplicate:
Print array to a file
How can I write the ouput (for example when I use an array), in a file?, I was trying with this:
...
print_r($this->show_status_redis_server());
$status_redis = ob_get_contents();
fwrite($file, $status_redis);
...
print_r()has a second parameters that if passed asTRUEreturns the output as a string.You could even cosinder using
var_exportfunction, as it provides better information about data types. Fromprint_ryou can’t tell if the variable is NULL of FALSE, butvar_exportlets use see exactly the data type of a variable.