note 94768 added to function.abs

From: Date: Tue, 24 Nov 2009 13:12:57 +0000
Subject: note 94768 added to function.abs
Groups: php.notes 
Request: Send a blank email to php-notes+get-163218@lists.php.net to get a copy of this message
Here is a simple function to make positives to negative and negatives to positive. This is function: <?php function turn($x) { $y = abs($x); if ($y == $x) return "-$y"; else return "$y"; } ?> You can use this code: <?php echo turn(-5) + turn(10); ?> The output is: -5 ; Because 5 + -10 = -10 ---- Server IP: 69.147.83.197 Probable Submitter: 78.176.99.229 ---- Manual Page -- http://www.php.net/manual/en/function.abs.php Edit -- https://master.php.net/note/edit/94768 Del: integrated -- https://master.php.net/note/delete/94768/integrated Del: useless -- https://master.php.net/note/delete/94768/useless Del: bad code -- https://master.php.net/note/delete/94768/bad+code Del: spam -- https://master.php.net/note/delete/94768/spam Del: non-english -- https://master.php.net/note/delete/94768/non-english Del: in docs -- https://master.php.net/note/delete/94768/in+docs Del: other reasons-- https://master.php.net/note/delete/94768 Reject -- https://master.php.net/note/reject/94768 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#163218) next »