Calc Builder Support

Calc Builder support
No se permite escribir sin estar logado. Por favor, login

Numbers after comma 28.08.2014 09:13

Hi, how can I limit to 2 the number of decimal after the comma?
Example: 51,12% not 51,123456789%

This is the PHP code that I used to calculate percentage:

$myresult=100/$number1 . '%';


Re: Numbers after comma 28.08.2014 10:12


You should use number_format php function ( like this:

$myresult=number_format((100/$number1),2) . '%';

If you want to decimal point of thousand separator, you should add 2 parameters to number_format function (Check docs).

Moonsoft Team
Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect

Lo que nuestros clientes opinan de nosotros