Hi, I would really appreciate if I could be helped on the following PHP code.
I have two arrays.
1) $user
2) $usertotal
$user can have as many names stored in it.
Example:
$user[0]="John";
$user[1]="Sean";
$user[2]="Nick";
$user[3]="Jay";
................
................
Similary,
$usertotal can have as many amount stored in it.
Example:
$usertotal[0]=100;
$usertotal[1]=60;
$usertotal[2]=150;
$usertotal[3]=0;
................
................
I am trying to build a finance related program where,
$user has spent $usertotal amount of money. For example in this case, John spent 100 dollars and Jay spent 0 dollars.
I also have a variable $average which is the average of all amount based on the number of users.
Now, what i am trying to do is display how much one user owes another user so that they all spend the same amount and be even with each other.
I am trying to compare each person's expense with $average and based on the difference the person should owe to another person.
For example, the output I want is something like this.
John owes $50 to Nick
Jay owes $100 to John
.....................
.....................
Suggestions and ideas would be highly appreciated. Thanks in advance.
I am a regular follower of Daniweb and this is my first question I thought I should really post.