bccomp

int bccomp(string left_operand, string right_operand, [int scale]) 
left_operand First number to compare
right_operand Second number to compare
scale Number of decimal places

Compares two numbers.

Returns:

0 if the same; 1 or -1 if different

Description:

Compares the value of the first number with the value of the second number. The optional decimal-places argument specifies the number of decimal places to compare. For example, if the number of decimal places is 2, bccomp() would compare to only two decimal places, regardless of how the numbers diverged beyond this level. The function returns 0 if the numbers are the same, 1 if the first number is greater than the second, or -1 if the second number is greater than the first.

Version: ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.