PHP code example of eonx-com / currencies

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

    

eonx-com / currencies example snippets


/**
 * Format a currency based on locale
 */

// Create formatter based on bitcoin with negative value
$formatter = new \EoneoPay\Currencies\Formatter('-1.051', 'xbt');

// Australia
echo $formatter->currency('en-AU'); // -฿1,601.05100000

// China
echo $formatter->currency('zh-CN'); // -฿ 1601.05100000

// France
echo $formatter->currency('fr-FR'); // -1 601,05100000 ฿

// Netherlands
echo $formatter->currency('nl-NL'); // ฿ -1.601,05100000

// Oman
echo $formatter->currency('ar-OM'); // ؜฿ ؜-١٬٦٠١٫٠٥١٠٠٠٠٠


/**
 * Format a number based on locale
 */
 
// Create formatter based on bitcoin with positive value
$formatter = new \EoneoPay\Currencies\Formatter('1.051', 'xbt');

// Australia
echo $formatter->numeric('en-AU'); // 1,601.05100000

// China
echo $formatter->numeric('zh-CN'); // 1601.05100000

// France
echo $formatter->numeric('fr-FR'); // 1 601,05100000

// Netherlands
echo $formatter->numeric('nl-NL'); // 1.601,05100000

// Oman
echo $formatter->numeric('ar-OM'); // ؜١٬٦٠١٫٠٥١٠٠٠٠٠