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 02:46] – googleguy | rfc:var-export-array-syntax [2020/04/09 22:32] – googleguy | ||
---|---|---|---|
Line 12: | Line 12: | ||
===== Proposal ===== | ===== Proposal ===== | ||
- | Instead of <code php> | + | This change proposes |
- | This will effect things like '' | + | - VAR_EXPORT_SHORT_ARRAY |
+ | - VAR_EXPORT_NO_INDEX | ||
+ | - VAR_EXPORT_COMPACT | ||
+ | |||
+ | '' | ||
+ | |||
+ | |||
+ | Instead of | ||
+ | |||
+ | <code php> | ||
+ | array ( | ||
+ | 0 => 1, | ||
+ | 1 => 2, | ||
+ | 2 => 3, | ||
+ | ) | ||
+ | </ | ||
+ | |||
+ | '' | ||
+ | |||
+ | <code php> | ||
+ | [ | ||
+ | 0 => 1, | ||
+ | 0 => 2, | ||
+ | 3 => 3, | ||
+ | ] | ||
+ | </ | ||
+ | |||
+ | This will effect things like '' | ||
So the following changes are also in effect: | So the following changes are also in effect: | ||
Line 31: | Line 58: | ||
' | ' | ||
) | ) | ||
+ | */ | ||
- | With the new change it would be | + | //With the new change it would be |
+ | var_export($obj, | ||
+ | |||
+ | /* | ||
(object) [ | (object) [ | ||
' | ' | ||
Line 55: | 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:: | ||
' | ' | ||
]) | ]) | ||
*/ | */ | ||
+ | </ | ||
+ | |||
+ | Using the other bitwise flags you can also do things like... | ||
+ | |||
+ | <code php> | ||
+ | var_export([1, | ||
+ | |||
+ | /* | ||
+ | outputs: | ||
+ | | ||
+ | [1, 2, 3] | ||
+ | */ | ||
+ | |||
+ | var_export([1, | ||
+ | |||
+ | /* | ||
+ | outputs: | ||
+ | | ||
+ | [0 => 1, 1 => 2, 2 => 3] | ||
+ | */ | ||
+ | |||
+ | var_export([1, | ||
+ | |||
+ | /* | ||
+ | outputs: | ||
+ | | ||
+ | [ | ||
+ | 1, | ||
+ | 2, | ||
+ | 3 | ||
+ | ] | ||
+ | */ | ||
+ | |||
+ | |||
</ | </ | ||
Line 88: | Line 159: | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
- | The change only requires changing two lines in '' | + | The change only requires changing two lines in '' |
+ | |||
+ | See https:// | ||
===== Implementation ===== | ===== Implementation ===== | ||
Line 94: | Line 167: | ||
===== References ===== | ===== References ===== | ||
https:// | https:// | ||
+ | |||
https:// | https:// | ||
+ | |||
+ | https:// | ||
===== Rejected Features ===== | ===== Rejected Features ===== | ||
rfc/var-export-array-syntax.txt · Last modified: 2020/04/10 09:24 by guilliamxavier