# Change var_dump to return information

- Thread: https://externals.io/message/4600
- Original archive: https://news-web.php.net/php.internals/4600
- Started by Dennis Sterzenbach on 2003-09-28T21:51:12+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #4600 — Dennis Sterzenbach — 2003-09-28T21:51:12+00:00

URL: https://externals.io/message/4600#4600

Hi,

I got in mind, that it might be interesting for debug purpose,
to obtain information like the output of `var_dump()` to a string.

Really would be nice being able to have something like
  $debug_info_obj = var_dump($obj);

or even by introducing a new function like $info=var_info($var);

What do you think about it?

Regards
  Dennis Sterzenbach

---

## #4601 — Xavier Spriet — 2003-09-29T00:10:08+00:00

URL: https://externals.io/message/4600#4601 · In reply to: #4600

IIRC, something like:
 `ob_start()`; var_dump($obj); $debug_info_obj = `ob_get_clean()`; would do
the trick.

Thanks,

Xavier


> Hi,
> 
> I got in mind, that it might be interesting for debug purpose,
> to obtain information like the output of `var_dump()` to a string.
> 
> Really would be nice being able to have something like
>   $debug_info_obj = var_dump($obj);
> 
> or even by introducing a new function like $info=var_info($var);
> 
> What do you think about it?
> 
> Regards
>   Dennis Sterzenbach
-- 
Xavier Spriet <xavier@wuug.org>
The Windsor Unix Users Group

---

## #4603 — Antony Dovgal — 2003-09-29T07:10:20+00:00

URL: https://externals.io/message/4600#4603 · In reply to: #4600

On Sun, 28 Sep 2003 23:51:12 +0200
"Dennis Sterzenbach" <dennis@darknoise.homeip.net> wrote:

> Hi,
> 
> I got in mind, that it might be interesting for debug purpose,
> to obtain information like the output of `var_dump()` to a string.
> 
> Really would be nice being able to have something like
>   $debug_info_obj = var_dump($obj);
> 
> or even by introducing a new function like $info=var_info($var);
> 
> What do you think about it?

I think you can use `var_export()`; in this case.

---
WBR,
Antony Dovgal aka tony2001
tony2001@phpclub.net
