I need an EQUATION or two. I’m trying to program a credit card debt calculator in PHP to basically tell me this as a result…..
if you currently owe ,000 in credit cards, and your average interest rate is 20%,
You will pay 9,196.96 in interest,
your total payment will be 9,196.96
and it will take you 54.33 years by paying the minimums.
the only part that i know for sure is to add the two numbers together to get the total amount.. beyond that i’m kind of lost, mostly because i don’t understand how credit card interest works on a deep level.
I understand the "simple interest" model, which is NOT what credit cards work on.. most of the stuff i find on the net is for mortgages and simple interest. that doesn’t help me in this case.
thanks in advance!!
the equations themselves will help.

Let B = credit card balance at the beginning of the month.
Let P = payment made on the credit card for the month.
Let i = monthly interest rate (e.g., if 18% annual, then 1.5% monthly)
Let N = credit card balance at the end of the month.
Assume no purchases or payments are made during the month (except at the end of the month.) Then,
N = B*(1+i) – P
If purchases are made during the month, then redefine B = average credit card balance.