PHP code example of rundiz / number

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

    

rundiz / number example snippets


// For English z/Number/NumberEng.php';

// For English use NumberEng(), for Thai use NumberThai()
$number_text = new Rundiz\Number\NumberEng();

echo $number_text->convertNumber('101');
// the result should be:
// one hundred and one (for English)
// หนึ่งร้อยเอ็ด (for Thai)



$number_text = new Rundiz\Number\NumberThai();

echo $number_text->convertBaht('3.23');
// the result should be:
// สามบาทยี่สิบสามสตางค์



$number = new Rundiz\Number\Number();

echo $number->toBytes('1.3KB'); // 1300
echo $number->toBytes('1.3KiB'); // 1331.2



$number = new Rundiz\Number\Number();

echo $number->fromBytes('100000'); // 100.00 KB
echo $number->fromBytes('133300'); // 133.30 KB
echo $number->fromBytes('10000', 'KiB); // 9.76 KiB



$Number = new Rundiz\Number\Number();

echo $Number->removeDotZero('1987.0000000000'); // 1987
echo $Number->removeDotZero('35.400'); // 35.400
echo $Number->removeDotZero('35.400', false); // 35.4
echo $Number->removeDotZero('35,400', false, ','); // 35,4 (european number format)