1--TEST-- 2gmp_gcdext() basic tests 3--SKIPIF-- 4<?php if (!extension_loaded("gmp")) print "skip"; 5?> 6--FILE-- 7<?php 8 9$n = gmp_init("34293864345"); 10$n1 = gmp_init("23434293864345"); 11 12$a = array( 13 array(123,45), 14 array(4341,9734), 15 array(23487,333), 16 array(-234234,-123123), 17 array(-100,-2234), 18 array(345,"34587345"), 19 array(345,"0"), 20 array("345556456",345873), 21 array("34545345556456","323432445873"), 22 array($n, $n1), 23 ); 24 25foreach ($a as $val) { 26 $r = gmp_gcdext($val[0],$val[1]); 27 $check = gmp_add(gmp_mul($val[0],$r['s']), gmp_mul($val[1],$r['t'])); 28 var_dump(gmp_strval($r['g'])); 29 var_dump(gmp_strval($check)); 30} 31 32var_dump(gmp_gcdext($val[0],array())); 33var_dump(gmp_gcdext(array(),array())); 34var_dump(gmp_gcdext(array(),array(),1)); 35var_dump(gmp_gcdext(array())); 36var_dump(gmp_gcdext()); 37 38echo "Done\n"; 39?> 40--EXPECTF-- 41string(1) "3" 42string(1) "3" 43string(1) "1" 44string(1) "1" 45string(1) "3" 46string(1) "3" 47string(4) "3003" 48string(4) "3003" 49string(1) "2" 50string(1) "2" 51string(2) "15" 52string(2) "15" 53string(3) "345" 54string(3) "345" 55string(1) "1" 56string(1) "1" 57string(1) "1" 58string(1) "1" 59string(3) "195" 60string(3) "195" 61 62Warning: gmp_gcdext(): Unable to convert variable to GMP - wrong type in %s on line %d 63bool(false) 64 65Warning: gmp_gcdext(): Unable to convert variable to GMP - wrong type in %s on line %d 66bool(false) 67 68Warning: gmp_gcdext() expects exactly 2 parameters, 3 given in %s on line %d 69NULL 70 71Warning: gmp_gcdext() expects exactly 2 parameters, 1 given in %s on line %d 72NULL 73 74Warning: gmp_gcdext() expects exactly 2 parameters, 0 given in %s on line %d 75NULL 76Done 77