Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decimal converter #6

Open
joaoherberto opened this issue Feb 16, 2013 · 0 comments
Open

decimal converter #6

joaoherberto opened this issue Feb 16, 2013 · 0 comments

Comments

@joaoherberto
Copy link

OK, I have spent countless hours trying to get a custom formatter working... but I just don't have the knowledge to code this. I found a PHP snippet that does what I need it to do, but how do I use the code with CustomFormatter?

Basically I want the user to input the actual number that will be in millions, ie: 2,300,587.00 but I want it formated in certain instances as only 2.3 Million etc.

Here is the code:


1000000000000) return round(($n/1000000000000),2).' trillion'; else if($n>1000000000) return round(($n/1000000000),2).' billion'; else if($n>1000000) return round(($n/1000000),2).' million'; else if($n>1000) return round(($n/1000),2).' thousand'; return number_format($n); } ``` echo nice_number('14120000'); //14.12 million ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant