note 93198 deleted from function.abs by danbrown
| From: | danbrown@php.net | Date: | Thu, 27 Aug 2009 22:25:09 +0000 |
| Subject: | note 93198 deleted from function.abs by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-159960@lists.php.net to get a copy of this message | ||
Note Submitter: Ister's Bane
----
Ister: Your version of sgn is typical of an unskilled PHP programmer (where "unskilled"
tends to be redundant). Here's a version of that function that doesn't suck:
function sgn($x)
{
return $x < 0 ? -1 :
$x == 0 ? 0 : -1;
}