简体   繁体   English

在 php 中以每天 1% 的金额计算天数

[英]get count of days against an amount with 1 percent amount daily in php

I need to get the count of days for an Total amount which will be giving 1 percent of amount 'daily' from the total Amount.我需要获取总金额的天数,该金额将从总金额中“每日”提供 1% 的金额。

Here is the formula if we knows the days:

$amount = 100;
$days = 100;

$daysCount = $amount/$days;

But I don't know the days count, I just wanted to get count of days.但我不知道天数,我只是想计算天数。 So how can I perform a formula to get days count when I don't know that an amount of 100, how many days it will take to distribute 1 percent of total amount daily?那么,当我不知道 100 的数量时,我如何执行一个公式来计算天数,每天分配总量的 1% 需要多少天?

$amount = 100;
$days = ?;

$daysCount = $amount/$days;
$days = $amount/$daysCount

Example:例子:

$amount = 100;
$days = 20;

$daysCount = 100/20;
//Value of $daysCount is 5.

According to this if you want to know $days根据这个如果你想知道 $days

Then然后

$days = $amount / $daysCount;
//$days Value is 20.

In short you need to know 2 values out of 3 to be able to calculate the 3rd value.简而言之,您需要知道 3 个值中的 2 个值才能计算第三个值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM