vendredi 29 janvier 2021

number_format() behavior is not as expected in php

i have make helper function for getting value by using number_formate()

 function getRatePrecision($rate)
    {
        return number_format((float)$rate, (int)getSingleOrganisationSetting('default_rates_percision'));
    }

I am passing value to this function to use number_format() there is another function getSingleOrganisationSetting('default_rates_percision') which is getting value from database which I need after . for example if it is 24.8888 it will convert it to 24.9 . But weirdly it is converting. it is converting 10687 to 10 which doesn't make sense. obviously this is error from my end but I can't figure it out why.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3pxJQ1p
via IFTTT

Aucun commentaire:

Enregistrer un commentaire