1--TEST-- 2gmp_gcdext() basic tests 3--EXTENSIONS-- 4gmp 5--FILE-- 6<?php 7 8$n = gmp_init("34293864345"); 9$n1 = gmp_init("23434293864345"); 10 11$a = array( 12 array(123,45), 13 array(4341,9734), 14 array(23487,333), 15 array(-234234,-123123), 16 array(-100,-2234), 17 array(345,"34587345"), 18 array(345,"0"), 19 array("345556456",345873), 20 array("34545345556456","323432445873"), 21 array($n, $n1), 22 ); 23 24foreach ($a as $val) { 25 $r = gmp_gcdext($val[0],$val[1]); 26 $check = gmp_add(gmp_mul($val[0],$r['s']), gmp_mul($val[1],$r['t'])); 27 var_dump(gmp_strval($r['g'])); 28 var_dump(gmp_strval($check)); 29} 30 31try { 32 var_dump(gmp_gcdext($val[0], array())); 33} catch (\TypeError $e) { 34 echo $e->getMessage() . \PHP_EOL; 35} 36try { 37 var_dump(gmp_gcdext(array(), array())); 38} catch (\TypeError $e) { 39 echo $e->getMessage() . \PHP_EOL; 40} 41 42echo "Done\n"; 43?> 44--EXPECT-- 45string(1) "3" 46string(1) "3" 47string(1) "1" 48string(1) "1" 49string(1) "3" 50string(1) "3" 51string(4) "3003" 52string(4) "3003" 53string(1) "2" 54string(1) "2" 55string(2) "15" 56string(2) "15" 57string(3) "345" 58string(3) "345" 59string(1) "1" 60string(1) "1" 61string(1) "1" 62string(1) "1" 63string(3) "195" 64string(3) "195" 65gmp_gcdext(): Argument #2 ($num2) must be of type GMP|string|int, array given 66gmp_gcdext(): Argument #1 ($num1) must be of type GMP|string|int, array given 67Done 68