On Fri, 2007-12-07 at 16:44 +0100, Derick Rethans wrote:
> 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";

Maybe it's from user input? And it is generally taught that if eval() is
the solution then you're on the wrong track.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to