logoalt Hacker News

shdon • today at 11:47 AM • 1 reply • view on HN

I guess the clamp function really is needed, as even in their release notes, they did the clamping using min/max incorrectly.

Their PHP8.5 examples are written as:

  var_dump(max($value, min($lower_bound, $upper_bound)));
but that should be:

  var_dump(max($lower_bound, min($value, $upper_bound)));
/facepalm

Replies

TimWolla • today at 12:18 PM

> Their PHP8.5 examples are written as:

That is false. The bounds are [0, 100] in both examples and 0 is correctly put as the first parameter to max() in 8.5.