clamp - chung-leong/qb GitHub Wiki
clamp - Restrict a number to a given range
float clamp( float $x, float $minValue, float $maxValue )
clamp() returns minValue if x is smaller than minValue or maxValue if x is greater than maxValue. Otherwise it returns x.
Parameters:
x - The number to process. It can be a scalar or an array.
minValue - The minimum value. It can be a scalar or an array.
maxValue - The maximum value. It can be a scalar or an array.
Return Value:
A number between minValue and maxValue or NAN. If x, minValue, or y is an array, then return value is also an array, the size of which match the largest of the three.
Version
1.0 and above.