PHP money_format

0

Hello I am receiving as parameters a string or integer, it does not matter ... I have used number_format in PHP to show quantities, I want to try money_format but I have trouble when trying to find numeric format for my country. Example: setlocale(LC_MONETARY, 'en_US')

Is there a format for the Guatemalan currency?

    
asked by Walter Cordova 28.11.2016 в 22:02
source

1 answer

2
  

The locale identifier for Guatemala is es_GT

To use it you could do it in the following way:

<?php
// Guatemala
setlocale(LC_MONETARY, 'es_GT');
echo money_format('%i', 1234).'<br/>';

// Argentina
setlocale(LC_MONETARY, 'es_AR');
echo money_format('%i', 1234).'<br/>';

// Estados Unidos
setlocale(LC_MONETARY, 'en_US');
echo money_format('%i', 1234).'<br/>';

?>

Demo here

    
answered by 28.11.2016 / 23:28
source