rfc:var-export-array-syntax
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
rfc:var-export-array-syntax [2020/03/30 16:02] – googleguy | rfc:var-export-array-syntax [2020/04/09 22:32] – googleguy | ||
---|---|---|---|
Line 12: | Line 12: | ||
===== Proposal ===== | ===== Proposal ===== | ||
+ | This change proposes 3 new bit-wise optional flags for '' | ||
+ | |||
+ | - VAR_EXPORT_SHORT_ARRAY | ||
+ | - VAR_EXPORT_NO_INDEX | ||
+ | - VAR_EXPORT_COMPACT | ||
+ | |||
+ | '' | ||
+ | |||
+ | |||
Instead of | Instead of | ||
- | <code php> | + | <code php> |
+ | array ( | ||
+ | 0 => 1, | ||
+ | 1 => 2, | ||
+ | 2 => 3, | ||
+ | ) | ||
+ | </ | ||
- | '' | + | '' |
- | <code php>[1, 2, 3]</ | + | <code php> |
+ | [ | ||
+ | 0 => 1, | ||
+ | 0 => 2, | ||
+ | | ||
+ | ] | ||
+ | </ | ||
This will effect things like '' | This will effect things like '' | ||
Line 37: | Line 58: | ||
' | ' | ||
) | ) | ||
+ | */ | ||
- | With the new change it would be | + | //With the new change it would be |
+ | var_export($obj, | ||
+ | |||
+ | /* | ||
(object) [ | (object) [ | ||
' | ' | ||
Line 61: | Line 86: | ||
' | ' | ||
)) | )) | ||
+ | */ | ||
- | With the changes it would be: | + | |
+ | //With the changes it would be: | ||
+ | |||
+ | var_export(new Foo, false, VAR_EXPORT_SHORT_ARRAY); | ||
+ | |||
+ | /* | ||
Foo:: | Foo:: | ||
' | ' | ||
Line 69: | Line 100: | ||
</ | </ | ||
- | ===== Backward Incompatible Changes ===== | + | Using the other bitwise flags you can also do things like... |
- | There shouldn' | + | |
- | However, there are some tests that test the output of '' | + | <code php> |
+ | var_export([1,2,3], false, VAR_EXPORT_SHORT_ARRAY | VAR_EXPORT_NO_INDEX | VAR_EXPORT_COMPACT); | ||
- | I hope that's clear. | + | /* |
+ | outputs: | ||
+ | |||
+ | [1, 2, 3] | ||
+ | */ | ||
- | In the event that this RFC is voted through I will, however, be updating these tests. | + | var_export([1,2,3], false, VAR_EXPORT_SHORT_ARRAY | VAR_EXPORT_COMPACT); |
+ | |||
+ | /* | ||
+ | outputs: | ||
+ | |||
+ | [0 => 1, 1 => 2, 2 => 3] | ||
+ | */ | ||
+ | |||
+ | var_export([1, | ||
+ | |||
+ | /* | ||
+ | outputs: | ||
+ | |||
+ | [ | ||
+ | 1, | ||
+ | 2, | ||
+ | 3 | ||
+ | ] | ||
+ | */ | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | ===== Backward Incompatible Changes ===== | ||
+ | There shouldn' | ||
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
Line 110: | Line 169: | ||
https:// | https:// | ||
+ | |||
+ | https:// | ||
===== Rejected Features ===== | ===== Rejected Features ===== | ||
rfc/var-export-array-syntax.txt · Last modified: 2020/04/10 09:24 by guilliamxavier