Laravel 遇到非数字值

Laravel A non-numeric value encountered

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

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

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

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

<?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;