PHP code example of nurbekjummayev / laravel-number-words
1. Go to this page and download the library: Download nurbekjummayev/laravel-number-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/ */
nurbekjummayev / laravel-number-words example snippets
use MultiLangFormatter\Facades\ML;
// Uzbek (default)
echo ML::number()->toWords(1234567);
// Output: "Bir million ikki yuz o'ttiz to'rt ming besh yuz oltmish yetti"
// English
echo ML::number()->locale('en')->toWords(1234567);
// Output: "One million two hundred thirty-four thousand five hundred sixty-seven"
// Russian
echo ML::number()->locale('ru')->toWords(1234567);
// Output: "Один миллион двести тридцать четыре тысячи пятьсот шестьдесят семь"
// Default locale
echo ml_number(12345);
// Output: "O'n ikki ming uch yuz qirq besh"
// Specific locale
echo ml_number(12345, 'en');
// Output: "Twelve thousand three hundred forty-five"
// With options
echo ml_number(1234.56, 'uz', ['decimals' => true, 'capitalize' => true]);
// Output: "Bir ming ikki yuz o'ttiz to'rt, 56"
use MultiLangFormatter\Facades\ML;
// Uzbek
echo ML::number()->toCurrency(1500.50);
// Output: "Bir ming besh yuz so'm 50 tiyin"
// English
echo ML::number()->locale('en')->toCurrency(1500.50);
// Output: "One thousand five hundred dollar 50 cent"
// Custom currency
echo ML::number()->toCurrency(2000, 'EUR');
// Output: "Ikki ming EUR"
// Using helper
echo ml_currency(1500.50);
// Output: "Bir ming besh yuz so'm 50 tiyin"
use MultiLangFormatter\Facades\ML;
// Uzbek
echo ML::date()->format('2024-03-15', 'full');
// Output: "2024-yil 15-Mart, Juma"
// English
echo ML::date()->locale('en')->format('2024-03-15', 'full');
// Output: "Friday, March 15, 2024"
// Russian
echo ML::date()->locale('ru')->format('2024-03-15', 'full');
// Output: "Пятница, 15 Март 2024"
// Using helper
echo ml_date('2024-03-15', 'full');
// Output: "2024-yil 15-Mart, Juma"
echo ml_date('2024-03-15', 'short', 'en');
// Output: "March 15"
use MultiLangFormatter\Facades\ML;
// Uzbek
echo ML::date()->relative('2024-03-14');
// Output: "1 kun oldin"
// English
echo ML::date()->locale('en')->relative('2024-03-14');
// Output: "1 day ago"
// Russian
echo ML::date()->locale('ru')->relative('2024-03-14');
// Output: "1 день назад"
// Using helper
echo ml_date_relative('2024-03-14');
// Output: "1 kun oldin"