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



wp_fuzzy_number_match › WordPress Function

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 Optional. The allowed variation. Default 1.
    Required: No
    Padrão: 1
Retorna:
  • (bool) Whether the numbers match within the specified precision.
Definido em:
Codex:

Checks 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;
}