mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
Fixed: [Deprecated] number_format(): Passing null to parameter (#729)
This commit is contained in:
parent
de076c80ef
commit
0c5f584bbd
5 changed files with 28 additions and 12 deletions
|
@ -360,6 +360,8 @@ function prn_r($var, $title = '', $print = true)
|
|||
}
|
||||
|
||||
/**
|
||||
* Convert special characters to HTML entities
|
||||
*
|
||||
* @param $txt
|
||||
* @param bool $double_encode
|
||||
* @param int $quote_style
|
||||
|
@ -371,6 +373,20 @@ function htmlCHR($txt, bool $double_encode = false, int $quote_style = ENT_QUOTE
|
|||
return (string)htmlspecialchars($txt ?? '', $quote_style, $charset, $double_encode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds commas between every group of thousands
|
||||
*
|
||||
* @param float|null $num
|
||||
* @param int $decimals
|
||||
* @param string|null $decimal_separator
|
||||
* @param string|null $thousands_separator
|
||||
* @return string
|
||||
*/
|
||||
function commify(?float $num, int $decimals = 0, ?string $decimal_separator = '.', ?string $thousands_separator = ','): string
|
||||
{
|
||||
return number_format($num ?? 0.0, $decimals, $decimal_separator, $thousands_separator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $txt
|
||||
* @param int $quote_style
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue