Re: Thoughts on Feature Request - Arithmetic
| From: | Derick Rethans | Date: | Fri, 07 Dec 2007 15:44:53 +0000 |
| Subject: | Re: Thoughts on Feature Request - Arithmetic | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-33834@lists.php.net to get a copy of this message | ||
On Fri, 7 Dec 2007, Nathan Rixham wrote:
> In-Built PHP Functions for parsing of basic arithmetic and if possible
> fraction to decimal and decimal to fraction
>
> $arithmetic_string = "3*5";
> echo arith($arithmetic_string); // returns float 15
What's wrong with eval?
<?php
eval( '$res = 3 * 5;' );
echo $res, "\n";
regards,
Derick
--
Derick Rethans
http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org