2017 © Pedro Peláez
 

library clamp

PHP clamp function to clamp a number between a minimum and a maximum.

image

matthewbaggett/clamp

PHP clamp function to clamp a number between a minimum and a maximum.

  • Wednesday, February 7, 2018
  • by matthewbaggett
  • Repository
  • 1 Watchers
  • 0 Stars
  • 122 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 67 % Grown

The README.md

Clamp() for PHP

PHP mathematical "Clamp" function. It clamps a variable between two numbers. Simple., (*1)

Build Status Coverage Status, (*2)

Usage:

    $value = clamp(
        $min,  // The minimum you will accept
        $max,  // The maximum you can take
        $value // The value you wish to clamp
    );

Why?

I got sick of writing what should be a core PHP function into a Util class, only to discover other people populating that util class with other nonsense that really shouldn't be in a Util class., (*3)

The Versions

07/02 2018

dev-master

9999999-dev

PHP clamp function to clamp a number between a minimum and a maximum.

  Sources   Download

MIT

The Development Requires

by Matthew Baggett

07/02 2018

v1.1

1.1.0.0

PHP clamp function to clamp a number between a minimum and a maximum.

  Sources   Download

MIT

The Development Requires

by Matthew Baggett

07/02 2018

v1.0

1.0.0.0

PHP clamp function to clamp a number between a minimum and a maximum.

  Sources   Download

MIT

The Development Requires

by Matthew Baggett