Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126919 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 qa.php.net (Postfix) with ESMTPS id 017F01A00BC for ; Mon, 24 Mar 2025 08:41:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1742805522; bh=So9SwgQChfeRPaH6PPbtW7itqo5yqkDshd6RyyVM5gQ=; h=Date:Subject:To:References:From:In-Reply-To:From; b=BEXubr/YhIV/BOJqNgHDmXS3s4i7uTiEKV5QOvdLIa2Jb06OFgs0ADvlY60zaSN9H JXBjcmH+k4GxUSB0ohmHy3ii/ajGmNLreEuwXvK9l/EFOMmNMvxDD/v/hkHXo6JSwS IZnvCyEMZLIFbrCbg4H4nF2HFhaOlMTOqIqGrv0AhIPev8+GthwAAdhaNYUVCdg/Y8 z8T4G4JuHbMFcaIKv7IriwEoMgwGietIiOIzPZ0UVd/faca6hxYuW1DYJUV5CXZbHk o6q7dgHWL2OjWwUThnNmyYvi4GQrgeL1wYvdP0jCgpMRKqB5jehdc8wU2yzJ7MmydX 2VLBp+MIdHsnw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 06C6618004A for ; Mon, 24 Mar 2025 08:38:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from dd26914.kasserver.com (dd26914.kasserver.com [85.13.128.127]) (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 ; Mon, 24 Mar 2025 08:38:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aimeos.com; s=kas202503061114; t=1742805655; bh=rGrF1AZbepSHP7QmGI60E5knYyRrb0IeRzj0MhbGoeM=; h=Date:Subject:To:References:From:In-Reply-To:From; b=uuDWzhveczoSHqj5VV8iUZ/bqHnFBuzmWkUt5Hw/FvvQ0u4z1Vdu6y3oq4lpaLJvI zLQq2noDpwoWy1DYDTQ8t9s+nGkUtRtclwFlWII4P/YhDZuBIeTu7YtN34Lmrh+eJG yK271UOosdZa0Gxq9UcJrtH/pzrh+m9xZ9zKUrgsVvIVUmG9brJOPIMNi/qPwTKLnp 6o14Jc5/2KIsD2GPJHbeeq4C9g8iIgodbD3fQUNDZAViI46kIqqxBzm9DdS4rHKjhs UuY5U3MiADPCq646dqnwDr3oe7arJ2IwnIYOIwTk1hH130X1cRnPlS/4Dc2HJupXYZ XZ8CtzYRMMJaA== Received: from [192.168.178.26] (dynamic-095-112-229-033.95.112.pool.telefonica.de [95.112.229.33]) by dd26914.kasserver.com (Postfix) with ESMTPSA id 4DAFD3FC18C7 for ; Mon, 24 Mar 2025 09:40:55 +0100 (CET) Message-ID: <56f9f67c-376d-46b0-8d84-0ebc21d7862e@aimeos.com> Date: Mon, 24 Mar 2025 09:40:54 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] Feedback for nullc Idea To: internals@lists.php.net References: <010f0195c30f8ccb-c7fa839e-ec18-4613-9851-9d96b943dca2-000000@us-east-2.amazonses.com> <3c3ba603-5101-4084-8745-c34b5cd3cfd8@rwec.co.uk> Content-Language: en-US Organization: Aimeos GmbH In-Reply-To: <3c3ba603-5101-4084-8745-c34b5cd3cfd8@rwec.co.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Bar: / From: norbert@aimeos.com (Aimeos | Norbert Sendetzky) On 23.03.25 19:37, Rowan Tommins [IMSoP] wrote: > I'm sympathetic to the problem you're trying to solve - the precedence > of ?? isn't always helpful - but I'm not sure I like the proposed > solution, for 3 reasons. > > 1) The name "nullc" is over-shortened and cryptic. The "c" looks almost > like an accident, and it doesn't actually do anything if given a null. To me, a wider approach might be more helpful, i.e. using "get" with an optional default value: if(get($a['val'])) // equals if($a['val] ?? null) if(get($a['val'], true)) // equals if($a['val] ?? true) if(get($a['val], 'yes')) // equals if($a['val] ?? 'yes') Best, -- Norbert Sendetzky Aimeos GmbH Rennbahnstr. 32 DE-22111 Hamburg E-Mail: norbert@aimeos.com Phone: +49 40 8668 4492 Web: aimeos.com Trade register: District court Hamburg HRB 143090 Managing director: Norbert Sendetzky VAT ID: DE302287839