Last active
October 22, 2019 14:19
-
-
Save kresnasatya/180de92483f91edfeb93fb93aa3f6c37 to your computer and use it in GitHub Desktop.
Util class in PHP (forgotten)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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