nice_price()

function nice_price(float $num, ?string $currency_symbol = null): string

Description

Formats a number as a price with commas for thousands separators and an optional currency symbol. This function is useful for displaying monetary values in a human-readable format.

Parameters

Parameter Type Description Default
$num float The number to be formatted as a price. N/A
$currency_symbol ?string Optional. A currency symbol to prepend (e.g., '$', '£', '€'). null

Return Value

Type Description
string The formatted price string.

Example Usage