# making var_dump and var_export even better

- Thread: https://externals.io/message/36603
- Original archive: https://news-web.php.net/php.internals/36603
- Started by Karoly Negyesi on 2008-03-27T07:14:31+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

---

## #36603 — Karoly Negyesi — 2008-03-27T07:14:31+00:00

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

Hi,

If var_dump would dump the type info into PHP comments then var_dump
would be also valid PHP code. That'd be very cool. I guess this would
be rather easy to code as we already have var_export.

Also, about circular references. Isn't it possible to reuse the
circular recognition from print_r and actually write out a reference
to the offending piece?

Regards,

Karoly Negyesi

---

## #36630 — Stanislav Malyshev — 2008-03-27T22:33:53+00:00

URL: https://externals.io/message/36603#36630 · In reply to: #36603

> Also, about circular references. Isn't it possible to reuse the
> circular recognition from print_r and actually write out a reference
> to the offending piece?

For var_export it isn't possible since there's no way to refer to the 
value being exported.
-- 
Stanislav Malyshev, Zend Software Architect
stas@zend.com   http://www.zend.com/
(408)253-8829   MSN: stas@zend.com

---

## #36691 — Edward Z. Yang — 2008-03-30T20:06:22+00:00

URL: https://externals.io/message/36603#36691 · In reply to: #36630

Stanislav Malyshev wrote:
> > […]
> 
> For var_export it isn't possible since there's no way to refer to the
> value being exported.

I know this is a little hackish, but what if we inserted a `NULL` in that
location, and then appended a few PHP statements that created the
references?

-- 
 Edward Z. Yang                        GnuPG: 0x869C48DA
 HTML Purifier <http://htmlpurifier.org> Anti-XSS Filter
 [[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]
