如何删除 laravel 中的多余数字

How to remove extra number in laravel

我正在使用 Laravel 5.5 并使用评级系统,在平均结果之后我得到

5.0000

我只想展示

5

5.0

这在 laravel 中怎么可能?

我正在使用这个包进行评级:https://github.com/AbdullahGhanem/rating

谢谢!

对我有用! [使用函数 php number_format()](https://www.w3schools.com/php/func_string_number_format.asp" PHP number_format() 函数")

您可以使用

floor() 

它会将数字向下舍入到最接近的整数。这仅适用于正值,这是一个重要的假设。对于负值,您希望使用 ceil(),但检查输入值的符号会很麻烦。

希望对您有所帮助。

请参考这个link http://php.net/manual/en/function.floor.php

使用:

 floor()