1--TEST-- 2gmp_intval() tests 3--SKIPIF-- 4<?php if (!extension_loaded("gmp")) print "skip"; ?> 5--FILE-- 6<?php 7 8var_dump(gmp_intval("-1")); 9var_dump(gmp_intval(-1)); 10var_dump(gmp_intval(-2349828)); 11var_dump(gmp_intval(2342344)); 12var_dump(gmp_intval(1.0001)); 13 14$g = gmp_init("12345678"); 15var_dump(gmp_intval($g)); 16 17try { 18 var_dump(gmp_intval("")); 19} catch (ValueError $e) { 20 echo $e->getMessage(), "\n"; 21} 22try { 23 var_dump(gmp_intval(new stdclass)); 24} catch (TypeError $e) { 25 echo $e->getMessage(), "\n"; 26} 27try { 28 var_dump(gmp_intval(array())); 29} catch (TypeError $e) { 30 echo $e->getMessage(), "\n"; 31} 32try { 33 var_dump(gmp_intval("1.0001")); 34} catch (ValueError $e) { 35 echo $e->getMessage(), "\n"; 36} 37 38echo "Done\n"; 39?> 40--EXPECT-- 41int(-1) 42int(-1) 43int(-2349828) 44int(2342344) 45int(1) 46int(12345678) 47gmp_intval(): Argument #1 ($num) is not an integer string 48gmp_intval(): Argument #1 ($num) must be of type GMP|string|int, stdClass given 49gmp_intval(): Argument #1 ($num) must be of type GMP|string|int, array given 50gmp_intval(): Argument #1 ($num) is not an integer string 51Done 52