7 lines
94 B
PHP
7 lines
94 B
PHP
<?php
|
|
|
|
function constrain(int $min, int $max, $n): int
|
|
{
|
|
return max(min($max, $n), $min);
|
|
}
|