ID: 35025 Updated by: [EMAIL PROTECTED] Reported By: milahu89 at web dot de -Status: Open +Status: Wont fix Bug Type: Feature/Change Request Operating System: irrelevant PHP Version: 5.0.5 New Comment:
It's easy to implement with the code you've provided. No need for yet another one rarely used core function. Previous Comments: ------------------------------------------------------------------------ [2005-10-30 17:10:01] milahu89 at web dot de Description: ------------ not really a bug, but i'd like to suggest a new math-function sgn(). it would make comparison of integer values much easier (an nicer, of course ;)). i've attached an example in the srccode part. Reproduce code: --------------- <?php // comparison with if/else : if($a < $b) print("a < b"); elseif($a == $b) print("a == b"); else print("a > b"); // comparison with sgn() : function sgn($int) { if($int > 0) return 1; if($int < 0) return -1; return 0; } switch(sgn($a-$b)){ case 1: print("a > b"); case 0: print("a == b"); case -1: print("a < b"); } ?> Expected result: ---------------- depends ;) Actual result: -------------- depends ... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35025&edit=1