1--TEST-- 2gmp_xor() basic tests 3--EXTENSIONS-- 4gmp 5--FILE-- 6<?php 7 8var_dump(gmp_strval(gmp_xor("111111", "2222222"))); 9var_dump(gmp_strval(gmp_xor(123123, 435234))); 10var_dump(gmp_strval(gmp_xor(555, "2342341123"))); 11var_dump(gmp_strval(gmp_xor(-1, 3333))); 12var_dump(gmp_strval(gmp_xor(4545, -20))); 13 14try { 15 var_dump(gmp_strval(gmp_xor("test", "no test"))); 16} catch (\ValueError $e) { 17 echo $e->getMessage() . \PHP_EOL; 18} 19 20$n = gmp_init("987657876543456"); 21var_dump(gmp_strval(gmp_xor($n, "34332"))); 22$n1 = gmp_init("987657878765436543456"); 23var_dump(gmp_strval(gmp_xor($n, $n1))); 24 25try { 26 var_dump(gmp_xor(array(), 1)); 27} catch (\TypeError $e) { 28 echo $e->getMessage() . \PHP_EOL; 29} 30try { 31 var_dump(gmp_xor(1, array())); 32} catch (\TypeError $e) { 33 echo $e->getMessage() . \PHP_EOL; 34} 35try { 36 var_dump(gmp_xor(array(), array())); 37} catch (\TypeError $e) { 38 echo $e->getMessage() . \PHP_EOL; 39} 40 41echo "Done\n"; 42?> 43--EXPECT-- 44string(7) "2120329" 45string(6) "476369" 46string(10) "2342340648" 47string(5) "-3334" 48string(5) "-4563" 49gmp_xor(): Argument #1 ($num1) is not an integer string 50string(15) "987657876574716" 51string(21) "987658017016065701376" 52gmp_xor(): Argument #1 ($num1) must be of type GMP|string|int, array given 53gmp_xor(): Argument #2 ($num2) must be of type GMP|string|int, array given 54gmp_xor(): Argument #1 ($num1) must be of type GMP|string|int, array given 55Done 56