note 38319 added to function.min
| From: | browneatbeewhyyoudoteedeeyou at rn2 dot php dot net | Date: | Tue, 16 Dec 2003 19:30:13 +0000 |
| Subject: | note 38319 added to function.min | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62082@lists.php.net to get a copy of this message | ||
min() can be used to cap values at a specific value. For instance, if you're grading papers and
someone has some extra credit, but that shouldn't make it to the final score:
$pts_possible = 50;
$score = 55;
// Percent will equal 1 if $score/$pts_possible is greater than 1
$percent = min($score/$pts_possible,1);
----
Manual Page -- http://www.php.net/manual/en/function.min.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38319
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38319&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38319&report=yes
Search -- http://master.php.net/manage/user-notes.php