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 var_dump(gmp_strval($r['g'])); 28 var_dump(gmp_strval($r['s'])); 29 var_dump(gmp_strval($r['t'])); 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(2) "-4" 43string(2) "11" 44string(1) "1" 45string(4) "-805" 46string(3) "359" 47string(1) "3" 48string(2) "32" 49string(5) "-2257" 50string(4) "3003" 51string(3) "-10" 52string(2) "19" 53string(1) "2" 54string(2) "67" 55string(2) "-3" 56string(2) "15" 57string(7) "-601519" 58string(1) "6" 59string(3) "345" 60string(1) "1" 61string(1) "0" 62string(1) "1" 63string(5) "84319" 64string(9) "-84241831" 65string(1) "1" 66string(13) "-156252240050" 67string(14) "16689072773537" 68string(3) "195" 69string(11) "46994884483" 70string(9) "-68772552" 71 72Warning: gmp_gcdext(): Unable to convert variable to GMP - wrong type in %s on line %d 73bool(false) 74 75Warning: gmp_gcdext(): Unable to convert variable to GMP - wrong type in %s on line %d 76bool(false) 77 78Warning: gmp_gcdext() expects exactly 2 parameters, 3 given in %s on line %d 79NULL 80 81Warning: gmp_gcdext() expects exactly 2 parameters, 1 given in %s on line %d 82NULL 83 84Warning: gmp_gcdext() expects exactly 2 parameters, 0 given in %s on line %d 85NULL 86Done 87