1--TEST-- 2Check for number base recognition 3--SKIPIF-- 4<?php if (!extension_loaded("gmp")) print "skip"; ?> 5--FILE-- 6<?php 7 /* Binary */ 8 $test[] = gmp_init("0b10011010010"); 9 $test[] = gmp_init("0b10011010010", 2); 10 $test[] = gmp_init("10011010010"); 11 $test[] = gmp_init("10011010010", 2); 12 13 /* Octal */ 14 $test[] = gmp_init("02322"); 15 $test[] = gmp_init("02322", 8); 16 $test[] = gmp_init("2322"); 17 $test[] = gmp_init("2322", 8); 18 19 /* Decimal */ 20 $test[] = gmp_init("1234"); 21 $test[] = gmp_init("1234", 10); 22 23 /* Hexidecimal */ 24 $test[] = gmp_init("0x4d2"); 25 $test[] = gmp_init("0x4d2", 16); 26 $test[] = gmp_init("4d2"); 27 $test[] = gmp_init("4d2", 16); 28 29 for ($i = 0; $i < count($test); $i++) { 30 printf("%s\n", gmp_strval($test[$i])); 31 } 32?> 33--EXPECT-- 341234 351234 3610011010010 371234 381234 391234 402322 411234 421234 431234 441234 451234 460 471234 48