Copying Excel's Circular Reference formula in PHP

让人想犯罪 __ 提交于 2019-12-06 05:55:54

By default, Excel will report a warning when you have a circular reference. The exception is if you have told it to handle circular references up to a predefined (you define how many) number of iterations. The way to do the latter in PHP is to use a loop for a predefined number of iterations.

$cycleCount = 12;

$Tax = 0; 
$Gross = 0;     
$Net_Amount = 10000; 
for ($cycle = 0; $cycle < $cycleCount; $cycle++) {
    $Gross = $Net_Amount - $Tax; 
    $Tax = $Gross * (14.1/100); 
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!