Math in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Eiolon
Forum Newbie
Posts: 17
Joined: Tue Feb 14, 2006 1:42 pm

Math in php

Post 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!
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

uhhh... if all you need is subtraction, use the subtraction operator

Code: Select all

$acount = $acount - $purchase_amount;
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Post 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
User avatar
christian_phpbeginner
Forum Contributor
Posts: 136
Joined: Sat Jun 03, 2006 2:43 pm
Location: Java

Re: Math in php

Post 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
Post Reply