PHP code example of khanovaskola / cislo

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

    

khanovaskola / cislo example snippets


use KhanovaSkola\Cislo;

Cislo::parse('nula'); // 0
Cislo::parse('jedna'); // 1
Cislo::parse('jeden'); // 1
Cislo::parse('pětadvacet'); // 25
Cislo::parse('tisíc devět set dvacet pět'); // 1925
Cislo::parse('devatenáct set dvacet pět')); // 1925
Cislo::parse('jeden tisic devet set a dvacet pet'); // 1925
Cislo::parse('garble'); // KhanovaSkola\\InvalidArgumentException

Cislo::toWord(0); // nula
Cislo::toWord(1337); // tisíc tři sta třicet sedm
Cislo::toWord(3e8); // tři sta milionů
Cislo::toWord(1e9); // KhanovaSkola\\OutOfRangeException