Skip to main content

maybe_format_numeric()

public static function maybe_format_numeric( $text, $operation, $number_format='' )

If the specified conditional logic operation requires a number formatted as numeric, this method will format it and return the result.

Since: 2.9.1

Source: common.php:5682

Parameters

NameTypeDefaultDescription
$textstringThe text to be formatted.
$operationstringThe conditional logic operation to be performed. (i.e. >, <, ...)
$number_formatstring''How the $text parameter is formatted. (i.e. currency, decimal_dot, ...). NOTE: This parameter is optional for backwards compatibility, but it is recommended to always specify it. When not specified, the method will "best guess" the format based on the $text parameter and the default currency of the site.

Returns

  • int | mixed | string — Returns a number formatted as a float.