Php

Asked • 04/25/19

How can I capture the result of var_dump to a string?

I'd like to capture the output of [`var_dump`](http://us3.php.net/manual/en/function.var-dump.php) to a string. The PHP docs say; >As with anything that outputs its result directly to the browser, the [output-control functions](http://us3.php.net/manual/en/ref.outcontrol.php) can be used to capture the output of this function, and save it in a string (for example). Can someone give me an example of how that might work? `print_r()` isn't a valid possibility because it's not going to give me the information that I need.

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.