Files
core/vendor/tysonandre/var_representation_polyfill
Hide_D 21e7a4d966 Dep: update
주로 PHAN
2021-08-06 22:39:09 +09:00
..
2021-08-06 22:39:09 +09:00
2021-08-06 22:39:09 +09:00
2021-08-06 22:39:09 +09:00
2021-08-06 22:39:09 +09:00
2021-08-06 22:39:09 +09:00
2021-08-06 22:39:09 +09:00
2021-08-06 22:39:09 +09:00
2021-08-06 22:39:09 +09:00

var_representation_polyfill

Build Status License

var_representation_polyfill is a polyfill for https://pecl.php.net/var_representation

This provides a polyfill for the function var_representation(mixed $value, int $flags = 0): string, which converts a variable to a string in a way that fixes the shortcomings of var_export()

See var_representation documentation for more details

Installation

composer require tysonandre/var_representation_polyfill

Usage

// uses short arrays, and omits array keys if array_is_list() would be true
php > echo var_representation(['a','b']);
[
  'a',
  'b',
]
// can dump everything on one line.
php > echo var_representation(['a', 'b', 'c'], VAR_REPRESENTATION_SINGLE_LINE);
['a', 'b', 'c']
php > echo var_representation("uses double quotes: \$\"'\\\n");
"uses double quotes: \$\"'\\\n"