Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jbrooksuk/php-clamp

Clamp one number between a min and max.
https://github.com/jbrooksuk/php-clamp

php

Last synced: about 8 hours ago
JSON representation

Clamp one number between a min and max.

Awesome Lists containing this project

README

        

# PHP Clamp

Clamp one number between a min and max.

## Usage

```php
// $number = clamp($value, $min, $max);

clamp(10, 1, 100); // => 10
clamp(10, 1, 5); // 5
clamp(-10, 1, 5); // 1
```

## License

PHP Clamp is licensed under [The MIT License (MIT)](/LICENSE).