【发布时间】:2019-01-10 04:11:29
【问题描述】:
PHP 版本 7.1.7 / Laravel 5.4
dump($this_tour->payments_to_operator_sum());
1012.0
dump(gettype($this_tour->payments_to_operator_sum()));
“双”
dump($this_tour->operator_price, gettype($this_tour->operator_price));
“1012.00”,“字符串”
dump((double)$this_tour->operator_price, gettype((double)$this_tour->opeartor_price);
1012.0,“双”
dump($this_tour->payments_to_operator_sum() == (double)$this_tour->operator_price);
假
为什么会是假的?
我很困惑。
PS。我理解“==”和“===”之间的区别,我想这与它无关。 当我这样做时:
dump((double)1012.0 == (double)"1012.00");
我明白了
是的
【问题讨论】:
标签: php double comparison equality php-internals