note 93198 added to function.abs
| From: | Ister' | Date: | Thu, 27 Aug 2009 22:24:25 +0000 |
| Subject: | note 93198 added to function.abs | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159959@lists.php.net to get a copy of this message | ||
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;
}
----
Server IP: 208.69.120.35
Probable Submitter: 71.72.235.91
----
Manual Page -- http://www.php.net/manual/en/function.abs.php
Edit -- https://master.php.net/note/edit/93198
Del: integrated -- https://master.php.net/note/delete/93198/integrated
Del: useless -- https://master.php.net/note/delete/93198/useless
Del: bad code -- https://master.php.net/note/delete/93198/bad+code
Del: spam -- https://master.php.net/note/delete/93198/spam
Del: non-english -- https://master.php.net/note/delete/93198/non-english
Del: in docs -- https://master.php.net/note/delete/93198/in+docs
Del: other reasons-- https://master.php.net/note/delete/93198
Reject -- https://master.php.net/note/reject/93198
Search -- https://master.php.net/manage/user-notes.php