gmp_fact


gmp apg

RETURNS the factorial of a number.





This function returns the factorial of a GMP number.



<?php

GMP gmp_fact 
( GMP|int|string $num )


where,

$num = The number to determine the factorial

?>
 

$num


Number to obtain the factorial.



  1 EXERCISE   

<?php

function detrfact01($f01)
{
    echo 
$f01 . '! = ' . gmp_fact($f01) . '<br>';
}

$arr01 = [ 0, 6, '012', '12', 12, 13, 0x0D, '0x0D', 30 ];

foreach(
$arr01 as $f01)
{
    
detrfact01($f01);
}

?> 

  2 EXERCISE   

<?php

echo 'PHP ' . PHP_VERSION . '<br><br>';

function 
detrfact02($f02)
{
    echo 
$f02 . '! = ' . gmp_fact($f02) . '<br>';
}

$arr02 = [ '0x0D', '0D',  -8, 'test01', "test02" ];
// Attention to array values

foreach($arr02 as $f02)
{
    
detrfact02($f02);
}

?>