Docs
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Constrain integer to interval `[min,max]`
|
||||
*
|
||||
* @param int $min lower bound
|
||||
* @param int $max upper bound
|
||||
*/
|
||||
function constrain(int $min, int $max, $n): int
|
||||
{
|
||||
return max(min($max, $n), $min);
|
||||
|
||||
Reference in New Issue
Block a user