wp_fuzzy_number_match()
Checks if two numbers are nearly the same.
This is similar to using round() but the precision is more fine-grained.
Хуков нет.
Возвращает
true|false
. Whether the numbers match within the specified precision.
Использование
wp_fuzzy_number_match( $expected, $actual, $precision );
- $expected(int|float) (обязательный)
- The expected value.
- $actual(int|float) (обязательный)
- The actual number.
- $precision(int|float)
- The allowed variation.
По умолчанию: 1
Список изменений
С версии 5.3.0 | Введена. |
Код wp_fuzzy_number_match() wp fuzzy number match WP 6.6.2
function wp_fuzzy_number_match( $expected, $actual, $precision = 1 ) { return abs( (float) $expected - (float) $actual ) <= $precision; }