write output of print_r in a txt file. PHP
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2628798/print-array-to-a-file">Print array to a file</a>  </p>
</blockquote>



<p>How can I write the ouput (for example when I use an array), in a file?, I was trying with this:</p>

<pre><code>    ...
print_r($this-&gt;show_status_redis_server());
$status_redis = ob_get_contents();
fwrite($file, $status_redis);
    ...
</code></pre>
