Page 1 of 1

Math in php

Posted: Fri Aug 11, 2006 7:56 pm
by Eiolon
I am looking for any resources that would help me with mathematics in PHP. Be it a good book, website or anything.

Here is what I have to accomplish:

Purchase Database

Index page displays: Account Code, Account Name, Budget and Amount Remaining

Every time somone adds a purchase it will subtract from the budget in that account and display the remaining amount of monies in that account.

Many thanks for your assistance!

Posted: Fri Aug 11, 2006 7:59 pm
by Luke
uhhh... if all you need is subtraction, use the subtraction operator

Code: Select all

$acount = $acount - $purchase_amount;

Posted: Fri Aug 11, 2006 8:04 pm
by SidewinderX
aside from the basic operators
Add: +
Subtract: -
Divide: /
Multiple: *
here is a list of other common mathamatical functions

http://us2.php.net/manual/en/ref.math.php

Re: Math in php

Posted: Sun Aug 13, 2006 4:23 am
by christian_phpbeginner
Eiolon wrote:I am looking for any resources that would help me with mathematics in PHP. Be it a good book, website or anything.
http://www.php.net/manual/en/language.expressions.php
Eiolon wrote: Here is what I have to accomplish:

Purchase Database

Index page displays: Account Code, Account Name, Budget and Amount Remaining

Every time somone adds a purchase it will subtract from the budget in that account and display the remaining amount of monies in that account.
http://www.php.net/manual/en/language.operators.php
http://www.php.net/manual/en/language.c ... ctures.php