[VOTE] var_representation() : readable alternative to var_export()

From: Date: Sat, 06 Feb 2021 00:38:22 +0000
Subject: [VOTE] var_representation() : readable alternative to var_export()
Groups: php.internals 
Request: Send a blank email to internals+get-113099@lists.php.net to get a copy of this message
Hi internals, Voting has started today on https://wiki.php.net/rfc/readable_var_representation and closes on 2021-02-19. This RFC proposes introducing a new function var_representation with the following differences from var_export: 1. var_representation() unconditionally returns a string 2. Use null instead of NULL - the former is recommended by more coding guidelines (https://www.php-fig.org/psr/psr-2/). 3. Change the way indentation is done for arrays/objects. See ext/standard/tests/general_functions/short_var_export1.phpt (e.g. always add 2 spaces, never 3 in objects, and put the array start on the same line as the key) 4. Render lists as "[\n 'item1',\n]" rather than "array(\n 0 => 'item1',\n)" Always render empty lists on a single line, render multiline by default when there are 1 or more elements 5. Prepend \ to class names so that generated code snippets can be used in namespaces without any issues. 6. Support VAR_REPRESENTATION_SINGLE_LINE in $flags. This will use a single-line representation for arrays/objects. 7. Escape control characters("\x00"-"\x1f" and "\x7f"(backspace)) inside of double quoted strings instead of single quoted strings with unescaped control characters mixed with . "\0" . . Thanks, -Tyson

« previous php.internals (#113099) next »