rfc:readable_var_representation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
rfc:readable_var_representation [2021/02/05 14:28] tandrerfc:readable_var_representation [2021/02/06 00:30] – Start voting tandre
Line 3: Line 3:
   * Date: 2021-01-22   * Date: 2021-01-22
   * Author: Tyson Andre, tandre@php.net   * Author: Tyson Andre, tandre@php.net
-  * Status: Under Discussion+  * Status: Voting
   * First Published at: http://wiki.php.net/rfc/readable_var_representation   * First Published at: http://wiki.php.net/rfc/readable_var_representation
   * Implementation: https://github.com/php/php-src/pull/6619 (currently using another name)   * Implementation: https://github.com/php/php-src/pull/6619 (currently using another name)
Line 49: Line 49:
 php > echo var_representation([]);  // always print zero-element arrays without a newline php > echo var_representation([]);  // always print zero-element arrays without a newline
 [] []
-// lines are indented by a multiple of 2+// lines are indented by a multiple of 2, similar to var_export but not exactly the same
 php > echo var_representation([(object) ['key' => (object) ['inner' => [1.0], 'other' => new ArrayObject([2])], 'other' => false]]); php > echo var_representation([(object) ['key' => (object) ['inner' => [1.0], 'other' => new ArrayObject([2])], 'other' => false]]);
 [ [
Line 397: Line 397:
 Adding a comment such as ''/* resource(2) of type (stream) */ null'' to the var_representation output with an opt-in flag (e.g. ''VAR_REPRESENTATION_ADD_TYPE_COMMENTS'') to add this information may be useful to explore in follow-up work (to meet more use cases of ''var_dump''). Adding a comment such as ''/* resource(2) of type (stream) */ null'' to the var_representation output with an opt-in flag (e.g. ''VAR_REPRESENTATION_ADD_TYPE_COMMENTS'') to add this information may be useful to explore in follow-up work (to meet more use cases of ''var_dump'').
  
-(Or ''/* RECURSION  */ NULL'', or ''[/* reference */ 123, /* reference */ 123]''+(Or ''/* RECURSION  */ NULL'', or ''[/* reference */ 123, /* reference */ 123]'', etc.)
  
 ===== Discussion ===== ===== Discussion =====
Line 470: Line 470:
 The last time ''var_export()'' changed was from ''<nowiki>stdClass::__set_state(array())</nowiki>'' to ''(object) []'' in PHP 7.3.0, but that was something that had a clearer reason to fix - ''<nowiki>stdClass::__set_state</nowiki>'' is an undeclared function and many users were inconvenienced by being unable to generate code for stdClass instances. The last time ''var_export()'' changed was from ''<nowiki>stdClass::__set_state(array())</nowiki>'' to ''(object) []'' in PHP 7.3.0, but that was something that had a clearer reason to fix - ''<nowiki>stdClass::__set_state</nowiki>'' is an undeclared function and many users were inconvenienced by being unable to generate code for stdClass instances.
  
-===== Proposed Voting Choices ===== +===== Vote ===== 
-Yes/No, requiring 2/3 majority.+This is a Yes/No vote, requiring 2/3 majority. Voting started on 2021-02-05 and ends 2021-02-19. 
 + 
 +<doodle title="Add var_representation($value, int $flags=0): string to php?" auth="tandre" voteType="single" closed="false"> 
 +   * Yes 
 +   * No 
 +</doodle>
  
 ===== References ===== ===== References =====
rfc/readable_var_representation.txt · Last modified: 2021/02/19 15:19 by tandre