jamesbrooks/php-clamp

Clamp one number between a min and max.

Maintainers

Package info

github.com/jbrooksuk/php-clamp

pkg:composer/jamesbrooks/php-clamp

Fund package maintenance!

jbrooksuk

Statistics

Installs: 1 341

Dependents: 0

Suggesters: 0

Stars: 13

Open Issues: 0

v0.1.0 2020-08-21 15:57 UTC

This package is auto-updated.

Last update: 2026-02-28 22:36:31 UTC


README

Clamp one number between a min and max.

Usage

// $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).