1--TEST-- 2BcMath\Number mul object by operator 3--EXTENSIONS-- 4bcmath 5--FILE-- 6<?php 7 8$values = [ 9 100, 10 '-20', 11 '0.01', 12 '-0.40', 13]; 14 15foreach ($values as $value1) { 16 $num1 = new BcMath\Number($value1); 17 18 foreach ($values as $value2) { 19 echo "{$value1} * {$value2}\n"; 20 $num2 = new BcMath\Number($value2); 21 $ret = $num1 * $num2; 22 var_dump($ret); 23 echo "\n"; 24 } 25} 26?> 27--EXPECT-- 28100 * 100 29object(BcMath\Number)#3 (2) { 30 ["value"]=> 31 string(5) "10000" 32 ["scale"]=> 33 int(0) 34} 35 36100 * -20 37object(BcMath\Number)#2 (2) { 38 ["value"]=> 39 string(5) "-2000" 40 ["scale"]=> 41 int(0) 42} 43 44100 * 0.01 45object(BcMath\Number)#4 (2) { 46 ["value"]=> 47 string(4) "1.00" 48 ["scale"]=> 49 int(2) 50} 51 52100 * -0.40 53object(BcMath\Number)#3 (2) { 54 ["value"]=> 55 string(6) "-40.00" 56 ["scale"]=> 57 int(2) 58} 59 60-20 * 100 61object(BcMath\Number)#2 (2) { 62 ["value"]=> 63 string(5) "-2000" 64 ["scale"]=> 65 int(0) 66} 67 68-20 * -20 69object(BcMath\Number)#1 (2) { 70 ["value"]=> 71 string(3) "400" 72 ["scale"]=> 73 int(0) 74} 75 76-20 * 0.01 77object(BcMath\Number)#3 (2) { 78 ["value"]=> 79 string(5) "-0.20" 80 ["scale"]=> 81 int(2) 82} 83 84-20 * -0.40 85object(BcMath\Number)#2 (2) { 86 ["value"]=> 87 string(4) "8.00" 88 ["scale"]=> 89 int(2) 90} 91 920.01 * 100 93object(BcMath\Number)#1 (2) { 94 ["value"]=> 95 string(4) "1.00" 96 ["scale"]=> 97 int(2) 98} 99 1000.01 * -20 101object(BcMath\Number)#4 (2) { 102 ["value"]=> 103 string(5) "-0.20" 104 ["scale"]=> 105 int(2) 106} 107 1080.01 * 0.01 109object(BcMath\Number)#2 (2) { 110 ["value"]=> 111 string(6) "0.0001" 112 ["scale"]=> 113 int(4) 114} 115 1160.01 * -0.40 117object(BcMath\Number)#1 (2) { 118 ["value"]=> 119 string(7) "-0.0040" 120 ["scale"]=> 121 int(4) 122} 123 124-0.40 * 100 125object(BcMath\Number)#4 (2) { 126 ["value"]=> 127 string(6) "-40.00" 128 ["scale"]=> 129 int(2) 130} 131 132-0.40 * -20 133object(BcMath\Number)#3 (2) { 134 ["value"]=> 135 string(4) "8.00" 136 ["scale"]=> 137 int(2) 138} 139 140-0.40 * 0.01 141object(BcMath\Number)#1 (2) { 142 ["value"]=> 143 string(7) "-0.0040" 144 ["scale"]=> 145 int(4) 146} 147 148-0.40 * -0.40 149object(BcMath\Number)#4 (2) { 150 ["value"]=> 151 string(6) "0.1600" 152 ["scale"]=> 153 int(4) 154} 155