Uma área de pesquisa sobre o WordPress para devs e autores do tema



wp_fuzzy_number_match ›

Desde5.3.0
Obsoleton/a
wp_fuzzy_number_match ( $expected, $actual, $precision = 1 )
Parâmetros: (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
    Padrão: 1
Retorna:
  • (bool) Whether the numbers match whithin the specified precision.
Definido em:
Codex:

Check if two numbers are nearly the same.

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



Fonte

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