[prev in list] [next in list] [prev in thread] [next in thread]
List: php-general
Subject: [PHP] math in PHP
From: Whitehawk Stormchaser <zerokode () gmx ! net>
Date: 2004-09-18 21:15:14
Message-ID: 200409182315.17101.zerokode () gmx ! net
[Download RAW message or body]
Hi!
I have been trying to make some sort of calculator in PHP, but I have stumbled
on a problem... I have been make some kind of dynamical calculator, unlike
most I have seen, that had $value1 [math operator] $value2 strict, but a
calculator, that can calculate basically anything ( even something like
(5*(8-3)+2*(4-1))^3 ), and can be put in as string variable...
I have tried things like this:
$var = "1+1+1+1";
echo $var + 0; //returns 1
or
$var = "1+1+1+1";
echo eval("\$var;"); //returns blank
or
$var = "1+1+1+1";
echo (int) $var; //returns 1
things like that...
Now my question is: is it possible to calculate the value of the string
somehow?
Thanks. Stormy.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic