money_format smarty

2

Good, I would like to be able to convert this figure:

23785638.83 to 23.785.638,83

in smarty I was thinking about using money_format but I get it whole, if you can help me I would appreciate it

    
asked by rosibel vicent 15.12.2017 в 03:52
source

2 answers

2

According to the documentation of SMARTY , it should be:

*.php: $smarty->assign( 'number', 23785638.83 );

*.tpl: {$number|number_format:2:",":"."}

Result: 23.785.638,83

    
answered by 15.12.2017 / 07:29
source
2

Try the function number_format reference link

according to the specification:

string number_format ( float $number , int $decimals = 0 , string $dec_point = "." , string $thousands_sep = "," )

We come to the conclusion:

 <?php
    echo number_format( 23785638.83, 2, ",", "." );
    ?>

example working: link

    
answered by 15.12.2017 в 06:27