note 106246 modified in function.gmp-sign by danbrown

From: Date: Mon, 24 Oct 2011 16:09:41 +0000
Subject: note 106246 modified in function.gmp-sign by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-184109@lists.php.net to get a copy of this message
Hi ! If you don't have the GMP extension, the sign function is really simple to code. Here an example of implementation : <?php function sign( $number ) { return ( $number > 0 ) ? 1 : ( ( $number < 0 ) ? -1 : 0 ); } echo sign( 500 ); // Return 1 echo sign( -500 ); // Return -1 echo sign( 0 ); // Return 0 ?> Thomas. --was-- Hi ! If you don't have the GMP extension, the sign function is really simple to code. Here an example of implementation : function sign( $number ) { return ( $number > 0 ) ? 1 : ( ( $number < 0 ) ? -1 : 0 ); } echo sign( 500 ); // Return 1 echo sign( -500 ); // Return -1 echo sign( 0 ); // Return 0 Thomas. http://php.net/manual/en/function.gmp-sign.php

« previous php.notes (#184109) next »