Oihana PHP

numbers

Table of Contents

Functions

clip()  : int|float
Bounds a number value between two numbers.

Functions

clip()

Bounds a number value between two numbers.

clip(int|float $value, int|float $min, int|float $max) : int|float
Parameters
$value : int|float

The value to clamp.

$min : int|float

The minimum value of the range.

$max : int|float

The maximum value of the range.

Tags
example
clip( 4  , 5 , 10 ) ;  // Returns 5
clip( 12 , 5 , 10 ) ; // Returns 10
clip( 6  , 5 , 10 ) ;  // Returns 6
author

Marc Alcaraz (ekameleon)

since
1.0.0
Return values
int|float

A value bounded between $min and $max.


        
On this page

Search results