Re: json_encode indent parameter
On Thu, 3 Jun 2021 at 11:49, Timon de Groot <tdegroot96@gmail.com> wrote:
> On 3-6-2021 10:00, Jordi Boggiano wrote:
> > I agree, but I'd make it accept a string|int much like JSON.stringify
> > does, because that way you let people pass in tabs too, or "🚀" if
> > that's how you want your JSON indented..
>
> I like the idea of accepting string|int.
>
> Accepting string|int means a zval needs to be used, with the possibility
> to pass any type of variable (please correct me if I'm wrong here).
> Should the function throw an error when it receives anything other than
> a string|int?
>
That's incorrect, as of PHP 8.0 Fast ZPP has a way to deal with the most
common union types, including int|string.
Best regards,
George P. Banyard
Thread (11 messages)