PHP code example of linuxartisan / tomoney

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

    

linuxartisan / tomoney example snippets




inuxArtisan\ToMoney\Money;

echo Money::formatToIndian(123456127.73); // to Indian
// "12,34,56,127.73"

echo Money::formatToUS(123456127.73); // to US
// "123,456,127.73"

echo Money::formatTo('en_GB', 123456127.73); // to custom
// "123,456,127.73"

echo Money::formatToIndian('12345.67'); // to Indian
echo Money::formatToUS('1234.56'); // to US
echo Money::formatTo('en_GB', '1234.56'); // to custom

return Money::formatTo('en_GB', "12abcd127.731");

return Money::formatTo('some_unsupported_locale', 12345);
// "12345"