PHP code example of jamesbrooks / php-clamp

1. Go to this page and download the library: Download jamesbrooks/php-clamp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jamesbrooks / php-clamp example snippets


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

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