Click on the banner to learn about and purchase my database training on Azure

Writing full number in PHP

Views: 17.623 views
Reading Time: 3 minutes

Good morning, dear readers!
All right with you?

Again, I'm bringing a function that I use in my projects, and I use it whenever I need to write the value of a number in full, which is not such an unusual situation, is it true?

Added 2 optional boolean parameters

  • $ bolView Currency: Defines if the function will add a currency reference (cents, real, etc)
  • $ bolWordFeminine: Defines whether the function will return two hundred or two hundred, for example.

To better filter the input parameter $ value, I used the function removeFormatNumber, which I talked about her here on the blog, in the post Removing Number Formatting in PHP.

As usual, I encapsulated the function in a class and created it statically, so I didn't have to instantiate the class whenever I needed to use the function.

Some examples of using the function: