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