wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



wp_fuzzy_number_match › WordPress Function

Depuis5.3.0
Dépréciéen/a
wp_fuzzy_number_match ( $expected, $actual, $precision = 1 )
Paramètres: (3)
  • (int|float) $expected The expected value.
    Requis: Oui
  • (int|float) $actual The actual number.
    Requis: Oui
  • (int|float) $precision Optional. The allowed variation. Default 1.
    Requis: Non
    Défaut: 1
Retourne:
  • (bool) Whether the numbers match within the specified precision.
Défini(e) dans:
Codex:

Checks if two numbers are nearly the same.

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


Source

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