1--TEST-- 2gmp_fact() basic tests 3--EXTENSIONS-- 4gmp 5--FILE-- 6<?php 7 8var_dump(gmp_strval(gmp_fact(0))); 9try { 10 var_dump(gmp_strval(gmp_fact(""))); 11} catch (\ValueError $e) { 12 echo $e->getMessage() . \PHP_EOL; 13} 14var_dump(gmp_strval(gmp_fact("0"))); 15try { 16 var_dump(gmp_strval(gmp_fact("-1"))); 17} catch (\ValueError $e) { 18 echo $e->getMessage() . \PHP_EOL; 19} 20try { 21 var_dump(gmp_strval(gmp_fact(-1))); 22} catch (\ValueError $e) { 23 echo $e->getMessage() . \PHP_EOL; 24} 25 26var_dump(gmp_strval(gmp_fact(20))); 27var_dump(gmp_strval(gmp_fact("50"))); 28var_dump(gmp_strval(gmp_fact("10"))); 29var_dump(gmp_strval(gmp_fact("0000"))); 30 31$n = gmp_init(12); 32var_dump(gmp_strval(gmp_fact($n))); 33$n = gmp_init(-10); 34try { 35 var_dump(gmp_strval(gmp_fact($n))); 36} catch (\ValueError $e) { 37 echo $e->getMessage() . \PHP_EOL; 38} 39 40try { 41 var_dump(gmp_fact(array())); 42} catch (\TypeError $e) { 43 echo $e->getMessage() . \PHP_EOL; 44} 45 46echo "Done\n"; 47?> 48--EXPECT-- 49string(1) "1" 50gmp_fact(): Argument #1 ($num) is not an integer string 51string(1) "1" 52gmp_fact(): Argument #1 ($num) must be greater than or equal to 0 53gmp_fact(): Argument #1 ($num) must be greater than or equal to 0 54string(19) "2432902008176640000" 55string(65) "30414093201713378043612608166064768844377641568960512000000000000" 56string(7) "3628800" 57string(1) "1" 58string(9) "479001600" 59gmp_fact(): Argument #1 ($num) must be greater than or equal to 0 60gmp_fact(): Argument #1 ($num) must be of type GMP|string|int, array given 61Done 62