F.t*_*ure 2 php laravel laravel-5.4
<td colspan="3">
<p class="text-left">
<h5>Discount ( @php echo "- $subtotalquant"; @endphp )</h5>
</p>
</td>
<td>
<p class="text-right">
<h5>
@php
echo"₱$subtotal";
@endphp
</h5>
</p>
</td>
Run Code Online (Sandbox Code Playgroud)
我想将这些值四舍五入到小数点后两位。但是数字格式似乎不起作用。
$subtotal = 40.608
$subtotalquant = 10.152
Run Code Online (Sandbox Code Playgroud)
像这样使用数字格式:
echo number_format((float)$subtotal, 2, '.', '');
echo number_format((float)$subtotalquant, 2, '.', '');
Run Code Online (Sandbox Code Playgroud)
有关更多详细信息,您可以在此处查看文档:https : //www.php.net/manual/en/function.number-format.php
| 归档时间: |
|
| 查看次数: |
13370 次 |
| 最近记录: |