]> git.mjollnir.org Git - moodle.git/commitdiff
Adding a useful mathematical shortcut.
authordefacer <defacer>
Wed, 2 Feb 2005 02:22:56 +0000 (02:22 +0000)
committerdefacer <defacer>
Wed, 2 Feb 2005 02:22:56 +0000 (02:22 +0000)
lib/moodlelib.php

index 177282dc011886e00afc79903897d9ba0283354e..f65d248732cacf3907b47e6dfaf50de0eff13829 100644 (file)
@@ -4980,5 +4980,16 @@ function message_popup_window() {
     return '';
 }
 
+// Used to make sure that $min <= $value <= $max
+function bounded_number($min, $value, $max) {
+    if($value < $min) {
+        return $min;
+    }
+    if($value > $max) {
+        return $max;
+    }
+    return $value;
+}
+
 // vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140:
 ?>