Skip to content

Instantly share code, notes, and snippets.

@kresnasatya
Last active October 22, 2019 14:19
Show Gist options
  • Save kresnasatya/180de92483f91edfeb93fb93aa3f6c37 to your computer and use it in GitHub Desktop.
Save kresnasatya/180de92483f91edfeb93fb93aa3f6c37 to your computer and use it in GitHub Desktop.
Util class in PHP (forgotten)
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Util
{
public function currencyDecimalConverter($value)
{
$number = (float)$value;
return number_format($number, 2, ",", ".");
}
public function currencyConverter($value)
{
$number = round((float)$value);
return number_format($number, null, null, ".");
}
public function currencyUpConverter($value)
{
$number = ceil((float)$value);
return number_format($number, null, null, ".");
}
public function currencyDownConverter($value)
{
$number = floor((float)$value);
return number_format($number, null, null, ".");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment