Attendize/app/Helpers/helpers.php

38 lines
900 B
PHP
Raw Normal View History

2016-02-29 15:59:36 +00:00
<?php
if(!function_exists('money')) {
/**
* @param int $amount
* @param string $currency_code
* @param int $decimals
* @param string $dec_point
* @param string $thousands_sep
*
* @return string
*/
function money($amount, $currency_code = '', $decimals = 2, $dec_point = '.', $thousands_sep = ',')
{
switch ($currency_code) {
case 'USD':
case 'AUD':
case 'CAD':
$currency_symbol = '$';
break;
case 'EUR':
$currency_symbol = '€';
break;
case 'GBP':
$currency_symbol = '£';
break;
2016-03-05 00:18:10 +00:00
default:
$currency_symbol = '';
break;
}
2016-03-05 00:18:10 +00:00
return $currency_symbol . number_format($amount, $decimals, $dec_point, $thousands_sep);
}
2016-03-05 00:18:10 +00:00
}