Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128578 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 DEC861A00BC for ; Thu, 28 Aug 2025 06:37:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1756362940; bh=tuJqpZhgUIc0wANnTq7p7asI25jrfBQff+KrzYnIXP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C+eQqBLdFRIFhur6GGgqYotdhiGqiBDW0Hcx09NVfS3G/eHL8ZODmiXgWkasmlVmv jOYxvU2zLUAkOgOyHkcPn7U5j0NlEadyDOHAr2PdJPRQlpVNQT8kbvgbChhPQPZ1CA O5Jk3M9Jiz7HtK/Ua2Asxz9ZwtXH6//LfYOBRq84LpQ9laDb2F4LB85tGAsQAarLnA WLyOFKDYM/4/C/VvwRbFioElNG7AYRbfRy2o0GSstIOkHBmpb00NVkyRiwTS1pSFG8 EiB1T/74inZw7hMFgTL4w7cZj3ildbBct2pS3V1eV+jZsriGKbU6JvUQ+oEFZn+jQ8 E6t1ggnQFYcPA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 40AA81801C7 for ; Thu, 28 Aug 2025 06:35:38 +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.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from sonic305-19.consmr.mail.ir2.yahoo.com (sonic305-19.consmr.mail.ir2.yahoo.com [77.238.177.81]) (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 ; Thu, 28 Aug 2025 06:35:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1756363016; bh=tuJqpZhgUIc0wANnTq7p7asI25jrfBQff+KrzYnIXP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=rd/IMfSEX2OuY9RNIOSKbSXGIQpFeqtOiROR41ucUr+asJOusg85mAWBbU1WWodaMGmy56E9qCFmOT4gLDILTwOu4N1paJU9wbp/oCI93tE0Bg/lPowu0CJzNsbnC8PiUkqMG0HpuCSaMl4LUGPob0OfViamPoMWBv/UjHZYXbYI+hHUvM+xYUiKKm7prTkU932RqnBWETLNqItGVjUfENYLui6n6Ce0DbHfTvjmmQ0zCTHBxT6iEdjhgaqmPQqg+s+iSAu1VJJFNFSV9TbiY/DdENar7/C6xcuG0hwbveJbl4oxeZJ7dza2ePwL+z/EFswCluPq6rNldythBVDA1Q== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1756363016; bh=CAThcKNXWMt3cgrmUfPcl92mnydLoWKCfgDwO+65Sim=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=bLAhIU+MCNq5xf67LizOBjk3YUNb80qjQcEMVzOjOH/tT9sxHT1vbQonW/UB0ucTSQ+HlVS5AKoBeJzFKPlALtLzgk65V9FaIsqM9TnPYDN++4gv+0aQbkQ/wBMaQduSSrCnFRw0tHuf2/PgW+Mb4YcnAxI8ppjPUePMDufsiM4M+193KHknx09rF1IdJUWmi2pvG/TxsvO/EWo0pFULoL7ZPGWuSWFONG+3/nLPib21bYNcx9bgw8xNnVffTZ1Ou/afUlNctcRqI5G0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FgDLc78iJXVVN4TkwCsVXSVT 4vXr0UhzU9gku9S8tq29NKoe186xEcf3rtQ83QAMItN6cOmQsBS6Nc6vkqTMCUYzHbbGL1SWJNC8 R39YXDisKutPDHbZPEZ1g20vREn.BP.MbA.vNAt_BGPtaavReMzal9T4n2ruA.klpI3FgVMdkMRR BeL4TU7B3mOnrwJ.0UR6EvXdIxmNEDDwH_PvyA_GKptm7_njPoXfso5xL9KphWQ-- X-Sonic-MF: X-Sonic-ID: 0ae2bba5-2d8a-4300-a757-443d1afa8019 Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ir2.yahoo.com with HTTP; Thu, 28 Aug 2025 06:36:56 +0000 Received: by hermes--production-ir2-7d8c9489f-w84wk (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 724d55076d43561b591b6f9a176ee5f4; Thu, 28 Aug 2025 06:36:53 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Message-ID: <1756359953764.3818129198.3624755324@yahoo.de> To: larry@garfieldtech.com Cc: php internals Subject: Re: [PHP-DEV] [RFC] [Discussion] Add clamp function Date: Thu, 28 Aug 2025 06:36:52 +0000 In-Reply-To: <090b74db-6e29-489e-870e-4c1e336c7746@app.fastmail.com> References: <090b74db-6e29-489e-870e-4c1e336c7746@app.fastmail.com> X-Mailer: Vivaldi Mail User-Agent: Vivaldi Mail/7.5.3735.64 Content-Transfer-Encoding: 7bit Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 From: hanskrentel@yahoo.de (Hans Krentel) On Wednesday 27 August 2025 18:40:51 (+02:00), Larry Garfield wrote: > ...So it looks like CSS is the oddball here. We should follow the clear > majority approach... While the majority of languages favor `clamp($value, $min, $max)`, dismissing the CSS order without examining the "why" misses a valuable perspective, especially for a language so intertwined with web development. The rationale for aligning with the majority (and the current RFC) boils down to the **Principle of Least Surprise within PHP's own ecosystem**. PHP is an imperative language. Its standard library functions, particularly in math, consistently take the value to be operated on as the first argument: `min($value1, $value2)`, `max($value1, $value2)`, `round($value, $precision)`. Introducing `clamp($min, $value, $max)` would break this pattern, making it the odd one out *within PHP itself*. This internal inconsistency would be a greater source of errors for PHP developers than not matching an external standard like CSS. The solution to the CSS dissonance is not to change the function but to **document it explicitly**: > **Note for Web Developers:** This function uses the argument order > `clamp(value, min, max)`, which differs from the CSS function > `clamp(min, value, max)`. This addresses the concern head-on. The ultimate win is not the argument order itself, but the mere existence of the function, which finally banishes the awkward and error-prone `max($min, min($max, $value))` incantation. My 2cents, --hakre