Skip to content

decimal converter #6

@joaoherberto

Description

@joaoherberto

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 ?>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions