<p>I'd like to capture the output of <a href="http://us3.php.net/manual/en/function.var-dump.php" rel="noreferrer"><code>var_dump</code></a> to a string.</p>

<p>The PHP documentation says;</p>

<blockquote>
  <p>As with anything that outputs its result directly to the browser, the <a href="http://us3.php.net/manual/en/ref.outcontrol.php" rel="noreferrer">output-control functions</a> can be used to capture the output of this function, and save it in a string (for example).</p>
</blockquote>

<p>What would be an example of how that might work?</p>

<p><code>print_r()</code> isn't a valid possibility, because it's not going to give me the information that I need.</p>

Use output buffering:
```
```
<?php
ob_start();
var_dump($someVar);
$result = ob_get_clean();
?>
```
```