note 39322 added to function.min
| From: | nonickAT8027DOTorg at rn2 dot php dot net | Date: | Sat, 24 Jan 2004 12:43:38 +0000 |
| Subject: | note 39322 added to function.min | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64109@lists.php.net to get a copy of this message | ||
I tested this with max(), but I suppose it applies to min() too: If you are working with numbers,
then you can use:
$a = ($b < $c) ? $b : $c;
which is somewhat faster (roughly 16%) than
$a = min($b, $c);
I tested this on several loops using integers and floats, over 1 million iterations.
I'm running PHP 4.3.1 as a module for Apache 1.3.27.
----
Manual Page -- http://www.php.net/manual/en/function.min.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39322
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39322&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39322&report=yes
Search -- http://master.php.net/manage/user-notes.php