1--TEST-- 2gmp_strval() tests 3--SKIPIF-- 4<?php if (!extension_loaded("gmp")) print "skip"; ?> 5--FILE-- 6<?php 7 8var_dump(gmp_strval()); 9var_dump(gmp_strval("")); 10var_dump(gmp_strval("", "")); 11var_dump(gmp_strval("", -1)); 12var_dump(gmp_strval(-1, "")); 13 14$fp = fopen(__FILE__, "r"); 15var_dump(gmp_strval($fp)); 16 17$g = gmp_init("9765456"); 18var_dump(gmp_strval($g)); 19var_dump(gmp_strval($g, -1)); 20var_dump(gmp_strval($g, 100000)); 21var_dump(gmp_strval($g, 10)); 22 23$g = gmp_init("-3373333"); 24var_dump(gmp_strval($g)); 25var_dump(gmp_strval($g, -1)); 26var_dump(gmp_strval($g, 100000)); 27var_dump(gmp_strval($g, 10)); 28 29var_dump(gmp_strval(array(1,2), array(1,2))); 30var_dump(gmp_strval(new stdclass, new stdclass)); 31var_dump(gmp_strval(array(1,2))); 32var_dump(gmp_strval(new stdclass)); 33 34echo "Done\n"; 35?> 36--EXPECTF-- 37Warning: gmp_strval() expects at least 1 parameter, 0 given in %s on line %d 38NULL 39bool(false) 40 41Warning: gmp_strval() expects parameter 2 to be long, string given in %s on line %d 42NULL 43 44Warning: gmp_strval(): Bad base for conversion: -1 (should be between 2 and %d or -2 and -%d) in %s on line %d 45bool(false) 46 47Warning: gmp_strval() expects parameter 2 to be long, string given in %s on line %d 48NULL 49 50Warning: gmp_strval(): supplied resource is not a valid GMP integer resource in %s on line %d 51bool(false) 52string(7) "9765456" 53 54Warning: gmp_strval(): Bad base for conversion: -1 (should be between 2 and %d or -2 and -%d) in %s on line %d 55bool(false) 56 57Warning: gmp_strval(): Bad base for conversion: 100000 (should be between 2 and %d or -2 and -%d) in %s on line %d 58bool(false) 59string(7) "9765456" 60string(8) "-3373333" 61 62Warning: gmp_strval(): Bad base for conversion: -1 (should be between 2 and %d or -2 and -%d) in %s on line %d 63bool(false) 64 65Warning: gmp_strval(): Bad base for conversion: 100000 (should be between 2 and %d or -2 and -%d) in %s on line %d 66bool(false) 67string(8) "-3373333" 68 69Warning: gmp_strval() expects parameter 2 to be long, array given in %s on line %d 70NULL 71 72Warning: gmp_strval() expects parameter 2 to be long, object given in %s on line %d 73NULL 74 75Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d 76bool(false) 77 78Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d 79bool(false) 80Done 81