1--TEST-- 2BcMath\Number construct 32 bit 3--EXTENSIONS-- 4bcmath 5--SKIPIF-- 6<?php 7if (PHP_INT_MAX > 2147483647) { 8 die('skip only 32 bit'); 9} 10?> 11--FILE-- 12<?php 13 14$values = [ 15 '0', 16 '0.00', 17 '.1', 18 '0.1', 19 '0.20', 20 '0.00000030', 21 '1234.0', 22 '123450', 23 '', 24 '-', 25 '.', 26 0, 27 123, 28 2147483646, 29 PHP_INT_MAX, 30 -2147483647, 31 PHP_INT_MIN, 32]; 33 34foreach ($values as $value) { 35 $num = new BcMath\Number($value); 36 var_dump($num); 37 unset($num); 38} 39?> 40--EXPECT-- 41object(BcMath\Number)#1 (2) { 42 ["value"]=> 43 string(1) "0" 44 ["scale"]=> 45 int(0) 46} 47object(BcMath\Number)#1 (2) { 48 ["value"]=> 49 string(4) "0.00" 50 ["scale"]=> 51 int(2) 52} 53object(BcMath\Number)#1 (2) { 54 ["value"]=> 55 string(3) "0.1" 56 ["scale"]=> 57 int(1) 58} 59object(BcMath\Number)#1 (2) { 60 ["value"]=> 61 string(3) "0.1" 62 ["scale"]=> 63 int(1) 64} 65object(BcMath\Number)#1 (2) { 66 ["value"]=> 67 string(4) "0.20" 68 ["scale"]=> 69 int(2) 70} 71object(BcMath\Number)#1 (2) { 72 ["value"]=> 73 string(10) "0.00000030" 74 ["scale"]=> 75 int(8) 76} 77object(BcMath\Number)#1 (2) { 78 ["value"]=> 79 string(6) "1234.0" 80 ["scale"]=> 81 int(1) 82} 83object(BcMath\Number)#1 (2) { 84 ["value"]=> 85 string(6) "123450" 86 ["scale"]=> 87 int(0) 88} 89object(BcMath\Number)#1 (2) { 90 ["value"]=> 91 string(1) "0" 92 ["scale"]=> 93 int(0) 94} 95object(BcMath\Number)#1 (2) { 96 ["value"]=> 97 string(1) "0" 98 ["scale"]=> 99 int(0) 100} 101object(BcMath\Number)#1 (2) { 102 ["value"]=> 103 string(1) "0" 104 ["scale"]=> 105 int(0) 106} 107object(BcMath\Number)#1 (2) { 108 ["value"]=> 109 string(1) "0" 110 ["scale"]=> 111 int(0) 112} 113object(BcMath\Number)#1 (2) { 114 ["value"]=> 115 string(3) "123" 116 ["scale"]=> 117 int(0) 118} 119object(BcMath\Number)#1 (2) { 120 ["value"]=> 121 string(10) "2147483646" 122 ["scale"]=> 123 int(0) 124} 125object(BcMath\Number)#1 (2) { 126 ["value"]=> 127 string(10) "2147483647" 128 ["scale"]=> 129 int(0) 130} 131object(BcMath\Number)#1 (2) { 132 ["value"]=> 133 string(11) "-2147483647" 134 ["scale"]=> 135 int(0) 136} 137object(BcMath\Number)#1 (2) { 138 ["value"]=> 139 string(11) "-2147483648" 140 ["scale"]=> 141 int(0) 142} 143