UTILITY

clamp()

Keep a number inside an inclusive range.

Signature

int|float clamp(int|float $value, int|float $min, int|float $max)

Example

clamp(120, 0, 100); // 100

Available from: 1.5.0

Reference navigation

Previous: camel()

Next: collapse_spaces()

Back to utilities