Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:131066 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 51ED01A00BD for ; Fri, 29 May 2026 17:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1780076789; bh=1pADb0WegM2igLQXkng6kEPqb3ctqd7Erfk+YNiFLVE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FsDx/6zgWkqBSHUdmE06Sq9nqH5xBQvOfr8s4++a24VgkXp1FVXTlT1XH/ptr22+b fTqEpnn7DaAkvxh3sKpiAwwwM8NcYUViTVxplh5FuCiA/aWS7RcGHXFl8LbyGbVBZ9 mdS9b7DAGwssodoJlV0AOeAtigeKroc63K+nGHuZkg/bCugLtqU/h333hNIMDcX8OD aDmB7IzNZKdRXMh8rBjf8zaBNfLYBWWf0QIguOVRo2OnFicG8qthb1i2ZvTmEVFVoJ LmHh9KL/qJliG5O3LMe4ojXnUgMW2AIg4fq0deAni8DjW8roy+uupMmi41XrkmNCYw S+IQvdDjhimEg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 294E6180048 for ; Fri, 29 May 2026 17:46:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.9 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 29 May 2026 17:46:18 +0000 (UTC) Received: by mail-qv1-f50.google.com with SMTP id 6a1803df08f44-8cbe69b122bso87228556d6.2 for ; Fri, 29 May 2026 10:46:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1780076773; cv=none; d=google.com; s=arc-20240605; b=bKTCYXhOxhOUfViidqK+Lbl4mQr1IRK3NjXbJpMfODVXi7of46fVm84I1kUBdSQ0w1 svGfIBLZ9e60D5sseoBUZbdVEyavb0+3iOe5FFJn9o4lSJhTPI9JmH083lTiIP1MF20R YIa6tbgH9R9I391xFYHvJyWU3Tl6+mvNjcgIRVtrZpbzI8twUYeLplkFNLG/n7DukQVa tgXaDDmYuiuebhJi2S9fRRJ38S847gJCyQ9r8GUZoHktrcGn6XJFlZz5jKFHu5bRgU4D rgHBm0o4GfQVYtiHLCTuP6NQxo442ZHxHy1/4lQLrA6U659pZRKkj6FGkBBwpXfRDXX/ QqlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=33vRRFhqvNdk9BaXIfN65Ii7cNf9O++iaZ+8QClWnkE=; fh=Ofn+XpSLefQyxrNYeqFK5V6BgIEzMTvoqvpJ6/SQfuk=; b=RYPTbUNvOYEpixD4ra8G+7EfSsgePzEKBBbtdyTkDWaQyvCQWkwSXLnYS24f6zFRdj 3Ls4UbiviSP0ySBqrjk4PTIx10xW4ZEhAIPPrywWFnhF41WXPjIr4wS5dp6NXo+/QU9K F4vt+3kxnsnT5bVecuSaBpe+1Ql9idOMMCtVdR//qxboFOvXFP7B8Ie4MVh1lpFWaRxH /m/M9UdkwOEWx1iVRuNi7izXGGN9d2pLl/K8zd18cbcIh7TdsTWgu2r2Z4IhworX16Bn jt3VJ8b4OWqcgE8tEABlEvnKQUWgufrPpVsUfZKcWbxbj9d7er2mBlwP15hJrIeudzmm mHsw==; darn=lists.php.net ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780076773; x=1780681573; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=33vRRFhqvNdk9BaXIfN65Ii7cNf9O++iaZ+8QClWnkE=; b=PK01w/rRPLwpockFH0eFF6oTxcFjBV35Iwd3NczqBfn/HKmrvMworZGQR7L9IrMDI4 C7XdVC4odFUSU3Fv4EZrrlNEVIecF8774l61ST20BojqfDt759jP9fzb89oxWeRlWzoL gbmUm9IagOb+twcS57v0Fh0uizwn7HP5nig9K23azVWytSPFLZyWA91Ceqa1S3TKkhM2 AscyWZsshbqBKNBxprdRobDcbodmOcYdep4DegfQvFxJ5l2dn5QiC67rPRfReq36k1rn yObnsuGJYrCriiS9VD2ohcRCYWq6IbJSaiQh7R/T7q6ovmJKUgRBJpq4q28/mRXrDdlw pd5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780076773; x=1780681573; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=33vRRFhqvNdk9BaXIfN65Ii7cNf9O++iaZ+8QClWnkE=; b=dIOhkNmNg9Dc6OT+GCDrXJzqtyMS6TbCQmX8RqSecBqqdyrjvjqswHN85pcOzjR0Yw 2IrIZQ2G89mr/1wrNzEJIWlCPMIpr9XxSvJyJI1TjCI/CKUziWobSNOScyqACaQ+aS6n rv9i5ZfOsPbU+8gOmDKKqvun+hL9BdmUOW7QUk0ZotJxyJ69qjOynydVLEuY2G7zXw45 GM96m1xL2r5xAB26lB8jmXym2yr/KrayJQE0mPgH+2iS/5t/nUyxUiD/vQSLiDegomVB h2aBNVs/vOUyInGczsUcW7YrX38kqrbTCVBmXRZPc34nOG1wzjUidtK1YG1htzqSr/1Z tf/g== X-Gm-Message-State: AOJu0YwmHxhjUAz5RmINzXWHp3YBtSJ5vblaSk4ZxxS86t1qlApkk9Fp Q+s+8mRWoy5lcSZB+BQ6+jtjRI9a5K5DTuJAZYvrxi0PWFYbVcZDgMDh6lU4OxPG6zqiuRyn7Rx FivcfMyKIj3Ue5ACcfF3yyXLAhttG9qJCqgbsYhN7Bg== X-Gm-Gg: Acq92OEQAgkaYiDfHA7pkDtwEPUV8IuvxiXQTX92YH1AX1Cueubdf0xl8JdT4NNd8pM prqw7XuZh346J4dmA19uVo1+7KT2XMnOYXWCzsoGuc1JYiMgl2kMwXijMOfYbn4cGFvDPXpUI87 FhhJ0bAXlAYbzH6cNzPDNktnGPQjgcT0U5CsbdVIJ8aI5/6R83BnuzZPeIyYSdqIlPkZ5bhnKHF AUeRVZUMA7mAOwPIJqowR0DpGXfBu2Og0hm2sJVZ/1KbbtqJpeJJS9UPgxz90wkEtXwX+PcYy+S nqKSYmjxIMv2XxwRIwyhxriGOlgEJBcqDOsHuBEvKeUq/txp X-Received: by 2002:a05:6214:2605:b0:8b5:e126:e77d with SMTP id 6a1803df08f44-8ccefb2beffmr12278256d6.8.1780076773021; Fri, 29 May 2026 10:46:13 -0700 (PDT) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <1c8f3c94-42fe-439f-80b2-6c2273b22f55@app.fastmail.com> In-Reply-To: <1c8f3c94-42fe-439f-80b2-6c2273b22f55@app.fastmail.com> Date: Fri, 29 May 2026 20:46:01 +0300 X-Gm-Features: AVHnY4Kq5tltOG44xNKFyJTJTFkGxeaph79AS4CneQ1Q8ah7tOYYLBFSQVRpkSE Message-ID: Subject: Re: [PHP-DEV] [Pre-RFC] Null coalescing associative array elements To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: amego2006@gmail.com (Alexander Egorov) On Fri, May 29, 2026 at 8:14=E2=80=AFPM Larry Garfield wrote: > > On Fri, May 29, 2026, at 11:58 AM, Alexander Egorov wrote: > > > array_filter will only cover the cases when you need to filter all > > fields by the same criteria (null's in this case). > > But it does not fit the case when you still have some mandatory fields > > even if they are null, but some are optional. > > At least in the simplest form, but otherwise in more complex forms > > we'll still come up with additional code. > > A data format that has a mix of required-even-if-null and optional fields= is a broken data format. We should not design language features around a = broken data format. (I realize that the broken data format is often provid= ed by a 3rd party, not the PHP developer, so it's not the PHP developer's f= ault that the data format is broken. But the point stands that we should n= ot build around that.) I generally agree with you about broken data formats, but I think it does n= ot really relate to the language feature itself. The reason and motivation why= I'm suggesting this feature is not to promote building around broken data forma= ts, but to have a convenient syntax for what is anyway being done more or less often. It is always developer's decision or necessity to do things this or that wa= y, and PHP anyway (as any other language) allows developers to have whatever data-structures they want without obligation to do things "right", because "right" is often very relative. The language is first and foremost an instrument. Specifically, associative arrays by themselves are completely decoupled from what exactly they are used for, and PHP anyway allows to dynamically add or remove (unset) keys from them. So, the feature I'm suggesting is about having a more conve= nient tool for that, and not about building around bad data formats.