Re: [RFC] [Discussion] Add clamp function

From: Date: Wed, 27 Aug 2025 16:06:44 +0000
Subject: Re: [RFC] [Discussion] Add clamp function
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-128573@lists.php.net to get a copy of this message
Hey, On 27.8.2025 15:34:53, Kyle Katarn wrote:
Hello, I handled the feedback received on the draft RCF https://wiki.php.net/rfc/clamp_v2 If I didn't forget anything this should be now ready for discussion. So I updated its status. There is an implementation proposal: https://github.com/php/php-src/pull/19434 And some draft for documentation here: https://github.com/php/doc-en/pull/4814 Thanks,
As others have noted before, what's the motivation of having the to-be-clamped value as first parameter rather than infixed between min and max? E.g. from CSS: https://developer.mozilla.org/en-US/docs/Web/CSS/clamp: |clamp(min, val, max)| Feels to me as the most natural order, too. You mention it was taken from the first RFC, but that one also did not discuss the ordering in the first place either. Bob

« previous php.internals (#128573) next »