【问题标题】:Laravel A non-numeric value encounteredLaravel 遇到一个非数字值
【发布时间】:2017-11-11 23:49:52
【问题描述】:
$variable1 = "1.000,00"; //<- this format error
$variable2 = "1.18";
$calc = $variable1 * $variable2;

返回计算错误:遇到格式不正确的数值

我的 PHO 版本:7.1 Mu Laravel 版本:5.5.20

【问题讨论】:

  • 你有什么问题?
  • 两个变量总计错误一个非良构

标签: php laravel php-7.1


【解决方案1】:

我不确定你想要实现什么,但是在运行你的代码之后,输出是1.18,因为你乘以11.0001 相同

<?php

$variable1 = "1.000,00"; //<- this format error
$variable2 = "1.18";
$calc = $variable1 * $variable2;

echo $calc;

也许这就是你在下面尝试做的事情

<?php

$variable1 = "1000.00"; //<- this format error
$variable2 = "1.18";
$calc = $variable1 * $variable2;

echo $calc;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-10
    • 2018-10-30
    • 2019-05-28
    • 1970-01-01
    相关资源
    最近更新 更多