How to add decimal points and thousands in PHP / Laravel

It is very common to require in a view to be able to visualize the numerical values ​​that are too large with decimal points. In the graphic part lavavel manages a template system called Blade. The printing of variables inside the blade is done by using double keys {{variable}}. Inside the keys we place the variable we want to print. Now to be able to obtain in Laravel and PHP in general, the numbers of thousands in the three zeros, you can use a very well known function that number_format.

Number_format PHP / Laravel Blade

{{ number_format($variable, x ) }}

Where x represents the number of decimals after the point we want to add.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *