Re: var_export() array format
| From: | Andreas Hennings | Date: | Sun, 18 Feb 2018 01:18:13 +0000 |
| Subject: | Re: var_export() array format | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-101885@lists.php.net to get a copy of this message | ||
On 18 February 2018 at 02:04, David Rodrigues <david.proweb@gmail.com> wrote:
> I just think that is not responsability of PHP to care about output format
> at core level (although we have the json pretty output support...).
Why not?
E.g. JSON_PRETTY_PRINT is something I use a lot, often in situations
where I don't or cannot use a 3rd party package.
E.g.
- if I abuse 3v4l.org as a php console
- in a one-off single-file cli script
- in a debugging session, or any temporary code.
- if my involvement with the project is not deep enough to justify
adding a dependency
>
> Maybe you can found some solution with packages.
See the last section of my initial message:
>>
>> Why not a userland implementation?
>> E.g. https://packagist.org/packages/riimu/kit-phpencoder
>>
>> var_export() is often used in experimental code or when just playing
>> around, situations where developers usually prefer to avoid adding a
>> 3rd party dependency.
>> Also there is no way to add a 3rd party dependency on e.g. 3v4l.org.
>> And a custom one-off implementation is not what developers should
>> spend their time on (although I did it a few times already).
If we already have a native function that generates PHP code, then we
should expect it to produce usable output..