Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116785 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 14890 invoked from network); 3 Jan 2022 16:10:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jan 2022 16:10:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A9EFB18054A for ; Mon, 3 Jan 2022 09:17:55 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,MISSING_HEADERS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 ; Mon, 3 Jan 2022 09:17:55 -0800 (PST) Received: by mail-wr1-f51.google.com with SMTP id j18so71145616wrd.2 for ; Mon, 03 Jan 2022 09:17:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:cc:subject:user-agent:in-reply-to:references:message-id :mime-version:content-transfer-encoding; bh=/CdPpF0g7fXb6cKriemVi6IJHmAqsPCK/t1SH/I/az8=; b=N9MvBngPlj8UT3vpnea2xeonwxzheD5O0T3OEAhE3rJX2LI+/0t0UEgjr5ufUJRY4+ b/KEhwv6BDFYTIp3qNhNocguSthn5yVcDrY1ofNRcFNZrQNLVAocxvoQW5csv11txEFT qdT43cGCUadk+Hho1oxsA3+0YwVg1R4USICEcQHr7Z1+86o/stS7KlTJ8LLKiemBAZO5 RWiU7GMD2MjtmfhOfGKamoXyIlIibcHlOKP+VPuh6EqQtJLm1mxz+XtiwfxjAXidIylP gvzI2hgyWFOTwC4LboITGlMeiXZOcy34ZEisgXbE6viXz3zGtK+q5ZiPbGuarNTsh668 v4Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:cc:subject:user-agent:in-reply-to :references:message-id:mime-version:content-transfer-encoding; bh=/CdPpF0g7fXb6cKriemVi6IJHmAqsPCK/t1SH/I/az8=; b=a/yJp+0f5UfoO38dmYab7lIASlAPjm1DwhbfpcztNCkuR68CGf2E9WUiDCG2vkxO6L ypWLJLBexZvMhS+pDbsAtoKqdM4jd1R9rkuKIk8k4bT4aJ9VxaNnbMfXx5ANYO5Hxk0t ZNgmxOruK5l9H/HtVuXcQ1hCrDrGt2yN9dxD1AjPmUL0ZdDtVlbheeCRMR9yhyetr93w UPpN6e+9GCYPA/nrhZSaE9IsdCQhuy3yi2yQLgdTNwSBa0Kn0P1fP3K7fpqdgR4ZSJbh pGMEBQcgF4BuIqmHFE/fsbt+GUngXd2VULStp/mh+ZW57euzcEvnoFvtINLb54xzCqTv HDwQ== X-Gm-Message-State: AOAM533KbhFYDve8VqgB6RcAIBbQDNtlvW9SMAVfTeN9+fEUudsEAawm IrHNnOOyimvTnPz5pMGdS7k3RsdL8ro= X-Google-Smtp-Source: ABdhPJz2D/o2zxhFUNIeQmdVHcdRIbRnRoiHk/XSI8mmY59E/FxQUhOaCjd4c+5TOQ/WEaKcG0Ycew== X-Received: by 2002:a05:6000:1d1:: with SMTP id t17mr38591796wrx.569.1641230274061; Mon, 03 Jan 2022 09:17:54 -0800 (PST) Received: from [127.0.0.1] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.gmail.com with ESMTPSA id j14sm36200257wrn.88.2022.01.03.09.17.53 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Jan 2022 09:17:53 -0800 (PST) Date: Mon, 03 Jan 2022 17:17:50 +0000 CC: internals@lists.php.net User-Agent: K-9 Mail for Android In-Reply-To: References: <1640910093.890171965@f721.i.mail.ru> <1641095231.967164658@f750.i.mail.ru> <2DC31ED4-8C27-4ADF-9946-8369C6E0A42F@gmail.com> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: =?US-ASCII?Q?Re=3A_=5BPHP-DEV=5D_RFC=3A_Stop_to_automatically_cast_nu?= =?US-ASCII?Q?meric-string_to_int_when_using_them_as_array-key?= From: rowan.collins@gmail.com (Rowan Tommins) On 3 January 2022 16:07:53 GMT, Chase Peeler wrot= e: >My mistake, I thought it did get casted=2E Still, I think you add a lot o= f >complexity because you'll need to keep track of whether or not a key was = a >string or not=2E There is no guarantee that all numeric keys were origina= lly >a string: >[ "1" =3D> "foo", 2 =3D> "bar"] I don't think anybody was proposing any such tracking, simply a shorthand = for this: array_map(strval(=2E=2E=2E), array_keys($array)); In other words, take the keys of any array, which might be a mixture of in= tegers and strings, and convert them all to strings, regardless of how they= were originally specified=2E The result being an array where the values ca= n all be safely passed to a function expecting strings, with strict_types= =3D1 in force=2E Regards, --=20 Rowan Tommins [IMSoP]