gmp_sub


gmp apg

SUBTRACT two GMP number.





This function returns a GMP number representing the ( $num1 - $num2 ).



<?php

GMP gmp_sub 
( GMP|int|string $num1, GMP|int|string $num2 )


where,

$num1 = The minuend

$num2 
= The subtrahend

?>
 

$num1


The number being subtracted from, ( minuend ).



$num2


The number subtracted from, ( subtrahend ).



  1 EXERCISE   

<?php

$a01a 
= PHP_INT_MAX;

$a01b = PHP_INT_MIN;

$s01ab = gmp_sub($a01a, $a01b);

echo 
'gmp_sub ( ' . $a01a . ', ' . $a01b . ' ) =<br>= ';

echo 
gmp_strval($s01ab);

?> 

  2 EXERCISE   

<?php

$a02a 
= '12345678';

$a02b = '87654321';

$s02ab = gmp_sub($a02a, $a02b);

echo 
'gmp_sub ( ' . $a02a . ', ' . $a02b . ' ) = ';

echo 
gmp_strval($s02ab);

?> 

  3 EXERCISE   

<?php

$a03a 
= '0xBC614E';

$a03b = '0X5397FB1';

$a03ab = gmp_sub($a03a, $a03b);

echo 
'gmp_add ( ' . $a03a . ', ' . $a03b . ' ) = ';

echo 
gmp_strval($a03ab);

?>