1--TEST-- 2gmp_setbit() basic tests 3--SKIPIF-- 4<?php if (!extension_loaded("gmp")) print "skip"; ?> 5--FILE-- 6<?php 7 8$n = gmp_init(-1); 9gmp_setbit($n, 10, -1); 10var_dump(gmp_strval($n)); 11 12$n = gmp_init(5); 13gmp_setbit($n, -20, 0); 14var_dump(gmp_strval($n)); 15 16$n = gmp_init(5); 17gmp_setbit($n, 2, 0); 18var_dump(gmp_strval($n)); 19 20$n = gmp_init(5); 21gmp_setbit($n, 1, 1); 22var_dump(gmp_strval($n)); 23 24$n = gmp_init("100000000000"); 25gmp_setbit($n, 23, 1); 26var_dump(gmp_strval($n)); 27 28gmp_setbit($n, 23, 0); 29var_dump(gmp_strval($n)); 30 31gmp_setbit($n, 3); 32var_dump(gmp_strval($n)); 33 34$b = ""; 35gmp_setbit($b, 23); 36gmp_setbit($b); 37gmp_setbit($b, 23,1,1); 38gmp_setbit($b,array()); 39$a = array(); 40gmp_setbit($a,array()); 41 42echo "Done\n"; 43?> 44--EXPECTF-- 45string(2) "-1" 46 47Warning: gmp_setbit(): Index must be greater than or equal to zero in %s on line %d 48string(1) "5" 49string(1) "1" 50string(1) "7" 51string(12) "100008388608" 52string(12) "100000000000" 53string(12) "100000000008" 54 55Warning: gmp_setbit() expects parameter 1 to be GMP, string given in %s on line %d 56 57Warning: gmp_setbit() expects at least 2 parameters, 1 given in %s on line %d 58 59Warning: gmp_setbit() expects at most 3 parameters, 4 given in %s on line %d 60 61Warning: gmp_setbit() expects parameter 1 to be GMP, string given in %s on line %d 62 63Warning: gmp_setbit() expects parameter 1 to be GMP, array given in %s on line %d 64Done 65