Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114703 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 35056 invoked from network); 3 Jun 2021 07:47:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jun 2021 07:47:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 993831804AE for ; Thu, 3 Jun 2021 01:00:46 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 3 Jun 2021 01:00:45 -0700 (PDT) Received: by mail-wm1-f52.google.com with SMTP id h3so2808503wmq.3 for ; Thu, 03 Jun 2021 01:00:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seld.be; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=1wygiXEF5tbUw/1y4fki6jwhmKFWtF0qk/awSwW1PoE=; b=IxMio8KAi//xRBgdzwv7WjyL9Kk3ywuJSWaR5DB2IeMZl496t/C0OBD7J7djji9vg1 NRRf+Tiy4gRBG6ay23hYNMlDNg+pb2XdOrpIeoBEnHNBRoYJ8oSMod+xhHi218glrLN/ 3LLm7aarD69GNwYIyjEIJjzqBRrrNjZyvXLaMxx/oLL+wAG/efWzhnHFq6RHJdQfbK70 ByBgS9qNrUfeqgpprSztJzk1RUAOejR5WtS14iZoibX/Vp+CUnTSiDODy/DAMB4V0NEf qr6BAAzyzl6zfBC6GohOQq44zPCav2kNlNRyRKdvNmJ1cerwEupxPzpvdun1RKUVtFyY eejQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=1wygiXEF5tbUw/1y4fki6jwhmKFWtF0qk/awSwW1PoE=; b=umUVB2yPLEtOQop/1HyGCc9NyszPDqP8r5/Txu+K36jccZ3YJ5s85eQbSygqwp8/DK 5aonh4hYrgKONdrKXuXQZRQ33EYKM53jeQxii0OX08EOv9atuVPwL1comRsPVhQLVD8E i9CCVWZoqF/gETE5oL6EvZwKLYfyenwiD9Dy9wnjVyPllgN1nz/K7/35m86SC9aCaNiG ush/gTN7J2IuswEYOgJ8dgatxmWb+6z9/SMMNsFHJ2lDHvsp4WoDok4WorSu6byQkHm8 JEio1KE7v1WMiKAb6ZuEjEoHrdLMfu9OoaU5s0lrAIs3Xv78Z5BZs1SOwbTOlh2Be8Pu K15A== X-Gm-Message-State: AOAM533ssMXYbOGarKhnQL+ybjtELzzBXA6iXqS+yRPs6eKBgjnY05U5 co27DlUaqT8rUfBwnGG1OeyrI8PZEtHk7w== X-Google-Smtp-Source: ABdhPJw2qVyx2ak3HjidWH2GPxIhYKIuHSrHkFQ22nYuMMB70i8HetZpcFrFLV1ROUrej6wHZlBGHQ== X-Received: by 2002:a1c:740b:: with SMTP id p11mr24413665wmc.94.1622707241914; Thu, 03 Jun 2021 01:00:41 -0700 (PDT) Received: from ?IPv6:2a02:168:4b6e:0:5952:8a1d:6e95:633a? ([2a02:168:4b6e:0:5952:8a1d:6e95:633a]) by smtp.gmail.com with ESMTPSA id p1sm1935354wmc.11.2021.06.03.01.00.41 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Jun 2021 01:00:41 -0700 (PDT) To: internals@lists.php.net References: Message-ID: <06f92428-a426-0afa-72ab-053e224a87ce@seld.be> Date: Thu, 3 Jun 2021 10:00:40 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Subject: Re: [PHP-DEV] json_encode indent parameter From: j.boggiano@seld.be (Jordi Boggiano) 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