relation.php
Tags
Table of Contents
Functions
- clamp() : callable|mixed
- Restricts value to given minimum and maximum.
Functions
clamp()
Restricts value to given minimum and maximum.
clamp(mixed ...$v) : callable|mixed
Can be used with anything comparable like int
, string
, \DateTime
, etc.
Basic usage may look like this:
clamp(1, 10, 0); // it will return 1
clamp(1, 10, 15); // it will return 10
clamp(1, 10, 6); // it will return 6
Parameters
- $v : mixed
Return values
callable|mixed —If all arguments are given result is returned. Passing just some or none will result in currying function return.