Re: Calculations
| From: | Adam Zey | Date: | Tue, 27 Jun 2006 17:39:20 +0000 |
| Subject: | Re: Calculations | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238736@lists.php.net to get a copy of this message | ||
Alex Major wrote:
Hi there list. Thanks for your help with my other questions. I was carrying on working through, and stumbled across a problem when trying to times something by the 'power' of something. By this I mean..in maths you can write 3 * (2 ^ 3), the answer to which would be 24. (as 2 ^ 3 = 8). The reason that I need this, is because I'm trying to double a variable x amount of times (x is set by another variable). For example my code is: $cost = $farm_cost * (2 ^ $farm_level); Any ideas how I would go about changing my calculation, as php dosn't seem to recognise ^ meaning 'to the power of'. Regards, Alex.... The manual is your friend. Seriously, don't come here looking for all the answers before you checked the manual. I searched for "power", and the first result was the function you want. RTFM. Regards, Adam Zey.