Skip to content
Advertisement

convert large values of string to number laravel. (int) gives wrong value

When I do:

JavaScript
JavaScript

Also:

JavaScript

And finally:

JavaScript

enter image description here

May I know why? And how do I fix the large numbers?

Advertisement

Answer

The Model Collection has 104000 But output shows 1,040,000.00. So you might have used Accessor / Mutator.

You can try this to convert,

JavaScript

Another way

Standard way to format model attributes in laravel is accessors & mutators, Please check it out.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement