PHP code example of vanaboom / persian-number-to-word
1. Go to this page and download the library: Download vanaboom/persian-number-to-word 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/ */
vanaboom / persian-number-to-word example snippets
php
$dictionary = new Apachish\PersianNumberToWords\Dictionary();
$converter = new Apachish\PersianNumberToWords\PersianNumberToWords($dictionary);
echo $converter->convert(0);
// صفر
echo $converter->convert(-10);
// منفی ده
echo $converter->convert(229);
// دویست و بیست و نه
echo $converter->convert(999999999);
// نهصد و نود و نه میلیون و نهصد و نود و نه هزار و نهصد و نود و نه
php
$dictionary = (new Apachish\PersianNumberToWords\Dictionary())
->setZero('هیچ')
->setNegative('منهای')
->setSeparator(' ُ ');
// Also ->setUnits(array $units) & -> setSuffixes(array $suffixes) are availabe
$converter = new Apachish\PersianNumberToWords\PersianNumberToWords($dictionary);
echo $converter->convert(0);
// هیچ
echo $converter->convert(-10);
// منهای ده
echo $converter->convert(229);
// دویست ُ بیست ُ نه
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.