title: Store print_r result into a variable as a string or text
body: <p>If I use <code>print_</code>r or <code>var_dump</code> it displays the result on the screen, but I want this data to be stored in a variable so that I can write it to a file.</p>
  
  <p>How do I do this?</p>