Re: json_encode indent parameter
| From: | Jordi Boggiano | Date: | Thu, 03 Jun 2021 08:00:40 +0000 |
| Subject: | Re: json_encode indent parameter | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-114703@lists.php.net to get a copy of this message | ||
On 03/06/2021 02:45, David Gebler wrote:
I would say though (a) is true enough but doesn't necessarily cover all use cases, adds more magic constants and doesn't provide equivalence to the JSON libraries of other common languages which permit for custom values, while (b) is less of an issue with PHP 8's named parameters. So if you do go ahead and make an RFC for this, I think my preference would be as a new parameter on json_encode accepting a positive integer.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.. Best, Jordi -- Jordi Boggiano @seldaek - https://seld.be