1--TEST-- 2BcMath\Number compare() 3--EXTENSIONS-- 4bcmath 5--FILE-- 6<?php 7 8$values2 = [ 9 [99, 'int'], 10 ['99.9999', 'string'], 11 [new BcMath\Number('99.9999'), 'object'], 12 [100, 'int'], 13 ['100', 'string'], 14 ['100.0000', 'string'], 15 [new BcMath\Number(100), 'object'], 16 [new BcMath\Number('100.0000'), 'object'], 17 [101, 'int'], 18 ['100.00001', 'string'], 19 [new BcMath\Number('100.00001'), 'object'], 20]; 21 22$value1 = new BcMath\Number('100.0000'); 23 24foreach ($values2 as [$value2, $type2]) { 25 echo "========== with {$type2} {$value2} ==========\n"; 26 var_dump($value1->compare($value2)); 27 28 echo "\n"; 29} 30?> 31--EXPECT-- 32========== with int 99 ========== 33int(1) 34 35========== with string 99.9999 ========== 36int(1) 37 38========== with object 99.9999 ========== 39int(1) 40 41========== with int 100 ========== 42int(0) 43 44========== with string 100 ========== 45int(0) 46 47========== with string 100.0000 ========== 48int(0) 49 50========== with object 100 ========== 51int(0) 52 53========== with object 100.0000 ========== 54int(0) 55 56========== with int 101 ========== 57int(-1) 58 59========== with string 100.00001 ========== 60int(-1) 61 62========== with object 100.00001 ========== 63int(-1) 64