Simple math with decimals in PHP

后端 未结 4 1107
抹茶落季
抹茶落季 2021-01-22 05:11

This is killing me! I\'ve never had so much trouble and I can\'t figure out what I\'m doing wrong here.

If I have a number, say 2.32, and I want to do math with it it wo

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-22 05:23

    I think the easiest solution would be to cast it to a float with floatval()

    $income = floatval($comission)

    leave the rest of the code as is and it should work as intended.

提交回复
热议问题