简体   繁体   中英

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.

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?

$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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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