1--TEST-- 2BcMath\Number mul int by operator 3--EXTENSIONS-- 4bcmath 5--FILE-- 6<?php 7 8$values = [ 9 100, 10 '-20', 11]; 12 13foreach ($values as $value1) { 14 $num1 = new BcMath\Number($value1); 15 16 foreach ($values as $value2) { 17 echo "{$value1} * {$value2}\n"; 18 $ret = $num1 * ((int) $value2); 19 $ret2 = ((int) $value1) * (new BcMath\Number($value2)); 20 if ($ret->compare($ret2) !== 0) { 21 echo "Result is incorrect.\n"; 22 } 23 var_dump($ret); 24 echo "\n"; 25 } 26} 27?> 28--EXPECT-- 29100 * 100 30object(BcMath\Number)#2 (2) { 31 ["value"]=> 32 string(5) "10000" 33 ["scale"]=> 34 int(0) 35} 36 37100 * -20 38object(BcMath\Number)#3 (2) { 39 ["value"]=> 40 string(5) "-2000" 41 ["scale"]=> 42 int(0) 43} 44 45-20 * 100 46object(BcMath\Number)#1 (2) { 47 ["value"]=> 48 string(5) "-2000" 49 ["scale"]=> 50 int(0) 51} 52 53-20 * -20 54object(BcMath\Number)#5 (2) { 55 ["value"]=> 56 string(3) "400" 57 ["scale"]=> 58 int(0) 59} 60