1--TEST-- 2gmp_testbit() basic tests 3--SKIPIF-- 4<?php if (!extension_loaded("gmp")) print "skip"; ?> 5--FILE-- 6<?php 7 8$n = gmp_init(0); 9var_dump(gmp_testbit($n, -10)); 10var_dump(gmp_testbit($n, 0)); 11var_dump(gmp_testbit($n, 1)); 12var_dump(gmp_testbit($n, 100)); 13 14$n = gmp_init(-1); 15var_dump(gmp_testbit($n, 1)); 16var_dump(gmp_testbit($n, -1)); 17 18$n = gmp_init("1000000"); 19var_dump(gmp_testbit($n, 1)); 20gmp_setbit($n, 1); 21var_dump(gmp_testbit($n, 1)); 22var_dump(gmp_strval($n)); 23 24gmp_setbit($n, 5); 25var_dump(gmp_testbit($n, 5)); 26var_dump(gmp_strval($n)); 27 28$n = gmp_init("238462734628347239571823641234"); 29var_dump(gmp_testbit($n, 5)); 30gmp_setbit($n, 5); 31var_dump(gmp_testbit($n, 5)); 32var_dump(gmp_strval($n)); 33 34gmp_clrbit($n, 5); 35var_dump(gmp_testbit($n, 5)); 36var_dump(gmp_strval($n)); 37 38echo "Done\n"; 39?> 40--EXPECTF-- 41Warning: gmp_testbit(): Index must be greater than or equal to zero in %s on line %d 42bool(false) 43bool(false) 44bool(false) 45bool(false) 46bool(true) 47 48Warning: gmp_testbit(): Index must be greater than or equal to zero in %s on line %d 49bool(false) 50bool(false) 51bool(true) 52string(7) "1000002" 53bool(true) 54string(7) "1000034" 55bool(false) 56bool(true) 57string(30) "238462734628347239571823641266" 58bool(false) 59string(30) "238462734628347239571823641234" 60Done 61