On Wed, Apr 8, 2020 at 3:12 PM Sherif Ramadan <theanomaly...@gmail.com> wrote:
>
> So to recap on what's been discussed so far, because I plan to bring this
> to a vote next week...
>
> I am updating the RFC to reflect that the change will no longer break
> backwards compatibility. I will be adding an flags argument with the
> following 3 optional bitwise flags for var_export:
>
> - VAR_EXPORT_SHORT_ARRAY [Triggers short-array syntax]
> - VAR_EXPORT_NO_INDEX [Discards numbered indexes in arrays (only if they
> are sequential from 0)]
> - VAR_EXPORT_NO_WHITESPACE [For one-liners]
>
> This complicates the implementation slightly, but I think it brings a
> greater net-benefit.

Hello,

First, thank you for proposing this RFC. I have no strong opinion
either way, but anyway it cannot work as is, because var_export
already has a second optional parameter (bool $return = false). You
could add the flags as a third optional parameter (int $options = 0),
or maybe make it replace (extend) the existing one and add an extra
constant, say VAR_EXPORT_RETURN = 1, so that it can be combined
(although I'm not sure that changing the type from bool to int (or
maybe bool|int) would be BC-compliant...)

Moreover the RFC currently says that var_export([1, 2, 3]) produces
```
array(1, 2, 3)
```
but it actually produces
```
array (
  0 => 1,
  1 => 2,
  2 => 3,
)
```

Regards,

-- 
Guilliam Xavier

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to