$package_with_fee = $packages_lot_qty * 1.1;
$total_sum = floatval($total_sum);
$package_with_fee = floatval($package_with_fee);
echo "Total sum is $total_sum vs Package with fee cost $package_with_fee";
if( $total_sum != $package_with_fee)
{
echo "ERROR";
}
当我运行代码时,这就是我得到的
Total sum is 3300 vs Package with fee cost 3300ERROR
我不确定为什么它的错误,两个php变量都是3300,但它只是不匹配并抛出错误。什么可能出错?
答案 0 :(得分:-2)
对两个变量执行var_dump并查看差异。有一些小的差异,如格式或其他任何。您还可以查看floatval http://php.net/manual/en/function.floatval.php