PHP code example of milantarami / number-to-words
1. Go to this page and download the library: Download milantarami/number-to-words library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
milantarami / number-to-words example snippets bash
echo NumberToWords::get(123456789);
//output : Twelve Crore Thirty-four Lakh Fifty-six Thousand Seven Hundred Eighty-nine Rupees and Twelve Paisa
bash
$config = [
'monetary_unit' => [ 'Dollar', 'Cent' ],
'numbering_system' => 'ins'
];
echo NumberToWords::get(123456789.12, $config);
//output : One Hundred Twenty-three Million Four Hundred Fifty-six Thousand Seven Hundred Eighty-nine Dollar and Twelve Cent
bash
$config = [
'monetary_unit' => [ 'Dollar', 'Cent' ],
'numbering_system' => 'ins',
'response_type' => 'array'
];
dd(NumberToWords::get(123456789.12, $config));
//output :
array:7 [▼
"integer" => 123456789
"integer_in_words" => "One Hundred Twenty-three Million Four Hundred Fifty-six Thousand Seven Hundred Eighty-nine Dollar"
"point" => 12
"point_in_words" => "Twelve Cent"
"original_input" => "123456789.12"
"formatted_input" => "123,456,789.12"
"in_words" => "One Hundred Twenty-three Million Four Hundred Fifty-six Thousand Seven Hundred Eighty-nine Dollar and Twelve Cent"
]