Un motore di ricerca WordPress per sviluppatori e autori di temi



wp_fuzzy_number_match ›

Da5.3.0
Deprecaton/a
wp_fuzzy_number_match ( $expected, $actual, $precision = 1 )
Parametri: (3)
  • (int|float) $expected The expected value.
    Richiesto:
  • (int|float) $actual The actual number.
    Richiesto:
  • (int|float) $precision The allowed variation.
    Richiesto: No
    Default: 1
Ritorna:
  • (bool) Whether the numbers match whithin the specified precision.
Definito a:
Codex:

Check if two numbers are nearly the same.

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



Sorgenti

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