PHP获得x金额并插入休息

PHP获得x金额并插入休息

问题描述:

I am currently creating a script that need to take each 100 amount and add "1" to the row "days". I wanted to divide the amount by 100. So 100/100=1, but if i get a number with 150 it would become 150/100=1.5. These extra 50 in the 150 number needs to be put to the side (going into another row). And there cannot be any decimals in the row "days".

What is the smartest/simplest way to do this?

Some code:

$amount = 150;
$days = $amount/100; //no decimals here
//update

我目前正在创建一个脚本,需要每100个金额并在“天”行中添加“1” 。 我想将金额除以100.所以100/100 = 1,但如果我得到一个150的数字,它将变为150/100 = 1.5。 这150个数字中的额外50个需要放在一边(进入另一行)。 并且“days”行中不能有任何小数。 p>

最聪明/最简单的方法是什么? p>

一些代码:

  $ amount = 150; 
 $ days = $ amount / 100;  //这里没有小数
 //更新
  code>  pre> 
  div>

Solution I found the solution to my question:

echo $amount%100;