1--TEST-- 2gmp_pow() basic tests 3--EXTENSIONS-- 4gmp 5--SKIPIF-- 6<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> 7--FILE-- 8<?php 9 10var_dump(gmp_strval(gmp_pow(2,10))); 11var_dump(gmp_strval(gmp_pow(-2,10))); 12var_dump(gmp_strval(gmp_pow(-2,11))); 13var_dump(gmp_strval(gmp_pow("2",10))); 14var_dump(gmp_strval(gmp_pow("2",0))); 15try { 16 gmp_pow("2", -1); 17} catch (ValueError $exception) { 18 echo $exception->getMessage() . "\n"; 19} 20var_dump(gmp_strval(gmp_pow("-2",10))); 21var_dump(gmp_strval(gmp_pow(20,10))); 22var_dump(gmp_strval(gmp_pow(50,10))); 23try { 24 gmp_pow(50,-5); 25} catch (ValueError $exception) { 26 echo $exception->getMessage() . "\n"; 27} 28 29$n = gmp_init("20"); 30var_dump(gmp_strval(gmp_pow($n,10))); 31$n = gmp_init("-20"); 32var_dump(gmp_strval(gmp_pow($n,10))); 33 34try { 35 var_dump(gmp_pow(2,array())); 36} catch (TypeError $e) { 37 echo $e->getMessage(), "\n"; 38} 39 40try { 41 var_dump(gmp_pow(array(),10)); 42} catch (\TypeError $e) { 43 echo $e->getMessage() . \PHP_EOL; 44} 45 46echo "Done\n"; 47?> 48--EXPECT-- 49string(4) "1024" 50string(4) "1024" 51string(5) "-2048" 52string(4) "1024" 53string(1) "1" 54gmp_pow(): Argument #2 ($exponent) must be greater than or equal to 0 55string(4) "1024" 56string(14) "10240000000000" 57string(17) "97656250000000000" 58gmp_pow(): Argument #2 ($exponent) must be greater than or equal to 0 59string(14) "10240000000000" 60string(14) "10240000000000" 61gmp_pow(): Argument #2 ($exponent) must be of type int, array given 62gmp_pow(): Argument #1 ($num) must be of type GMP|string|int, array given 63Done 64