PHP7.3 报错: A non well formed numeric value encountered
从PHP5.6 升级为PHP7.3 后,某接口报错: A non well formed numeric value encountered
看了下,是把字符串和数字放在一起做加减乘除计算,会导致报错。。。代码如下
$commissionLevel1 = (float)($commissionSetting->level1 / 100);//$commissionSetting->level1 是个字符串: “20%”
改为
$commissionLevel1 = (float)$commissionSetting->level1 / 100;
先将字符串转化为浮点数字,然后再计算即可
看来PHP7.3 比 PHP5.6 严格了
posted on 2020-09-01 17:54 Raltu&RealRain 阅读(928) 评论(0) 编辑 收藏 举报