A compact, more readable alternative to var_export.

var_representation is a compact alternative to var_export that properly escapes control characters

License: BSD-3-Clause

Latest releases

Version Release Download
0.1.4 2022-10-16 var_representation-0.1.4.tgz
0.1.3 2022-10-14 var_representation-0.1.3.tgz
0.1.2 2022-08-31 var_representation-0.1.2.tgz
0.1.1 2021-08-14 var_representation-0.1.1.tgz
0.1.0 2021-06-24 var_representation-0.1.0.tgz
Show all releases


Version Message
0.1.4 * No code changes.
* Adds steps to build DLLs for Windows in CI.
0.1.3 * Fix improper detection of VAR_REPRESENTATION_UNESCAPED flag. The var_representation function was previously checking for VAR_REPRESENTATION_SINGLE_LINE due to missing parenthesis in a bitwise operation.
0.1.2 * Switch from infinite recursion detection on the object's properties to infinite recursion detection on the object itself.
This conforms with the change to var_export/debug_zval_dump in php 8.2-dev,
and would allow data structures to safely start returning temporary arrays that can be garbage collected to save memory
(after dumping the representation) starting in php 8.2+.
0.1.1 * Optimize escaping single quoted strings
* Add a new flag VAR_REPRESENTATION_UNESCAPED to always encode strings as single quoted strings without escaping control characters.
This may be useful when the result of var_representation is escaped again before being rendered (e.g. json encoding),
or when a short representation is desired.
0.1.0 * Fix handling of dumping arrays created from $GLOBALS in php versions prior to 8.1
* Move the C var_representation_ex API to var_representation.h
Show complete changelog