wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



wp_fuzzy_number_match › WordPress Function

Od5.3.0
Przestarzałyn/a
wp_fuzzy_number_match ( $expected, $actual, $precision = 1 )
Parametry: (3)
  • (int|float) $expected The expected value.
    Wymagane: Tak
  • (int|float) $actual The actual number.
    Wymagane: Tak
  • (int|float) $precision Optional. The allowed variation. Default 1.
    Wymagane: Nie
    Domyślny: 1
Powrót:
  • (bool) Whether the numbers match within the specified precision.
Zdefiniowane na:
Codex:

Checks if two numbers are nearly the same.

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


Źródło

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