📜 ⬆️ ⬇️

Numbers in lowercase.

Inspired by Habra and fasting about Plurals.
I once had a task in PHP, in which it was required to locally output various huge numbers in lowercase, with tenths and thousandths. I wrote a classic for this, a bit clumsy in code, but it works stably and understands numbers like " 100300,3940023 " were displayed as " one hundred thousand three hundred and three million nine hundred and forty thousand twenty-three ten million ".

Using a classic is simple:
$out_string = NUM2STR::translate($string_number," ",true);

Class can be said from my resource: download (1.52 Kb)
Update: rub. download (1.53 Kb) is adapted for money + fix, so that 0 is replaced with "zero".

')

Source: https://habr.com/ru/post/15677/


All Articles