PHP code example of zetflake / number-to-words

1. Go to this page and download the library: Download zetflake/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/ */

    

zetflake / number-to-words example snippets


use Zetflake\NumberToWords\Facades\NumberToWords;

NumberToWords::convert(1234);
// "One thousand two hundred thirty-four"

NumberToWords::currency(1500.50);
// "One thousand five hundred shillings and fifty cents"

NumberToWords::currency(1500.50, 'dollars', 'cents');
// "One thousand five hundred dollars and fifty cents"

NumberToWords::case('upper')->convert(42);
// "FORTY-TWO"

use Zetflake\NumberToWords\NumberToWords;

public function __construct(private NumberToWords $words) {}

number_to_words(99);          // "Ninety-nine"
amount_in_words(99.25);       // "Ninety-nine shillings and twenty-five cents"