wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



wp_fuzzy_number_match › WordPress Function

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 Optional. The allowed variation. Default 1.
    Richiesto: No
    Default: 1
Ritorna:
  • (bool) Whether the numbers match within the specified precision.
Definito a:
Codex:

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