WordPress开发者和主题制作者的搜索引擎



wp_fuzzy_number_match ›

Since5.3.0
已弃用n/a
wp_fuzzy_number_match ( $expected, $actual, $precision = 1 )
参数: (3)
  • (int|float) $expected The expected value.
    Required: Yes
  • (int|float) $actual The actual number.
    Required: Yes
  • (int|float) $precision The allowed variation.
    Required: No
    默认: 1
返回:
  • (bool) Whether the numbers match whithin the specified precision.
定义在:
文档:

Check if two numbers are nearly the same.

This is similar to using round() but the precision is more fine-grained.



源码

function wp_fuzzy_number_match( $expected, $actual, $precision = 1 ) {
	return abs( (float) $expected - (float) $actual ) <= $precision;
}