Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33838 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35014 invoked by uid 1010); 7 Dec 2007 16:23:59 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 34999 invoked from network); 7 Dec 2007 16:23:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Dec 2007 16:23:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=robert@interjinn.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=robert@interjinn.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain interjinn.com from 66.11.173.122 cause and error) X-PHP-List-Original-Sender: robert@interjinn.com X-Host-Fingerprint: 66.11.173.122 unknown Received: from [66.11.173.122] ([66.11.173.122:37490] helo=blobule.interjinn.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0D/03-16679-B9379574 for ; Fri, 07 Dec 2007 11:23:57 -0500 Received: by blobule.interjinn.com (Postfix, from userid 2000) id 7697C5AD652; Fri, 7 Dec 2007 11:23:46 -0500 (EST) To: Derick Rethans Cc: Nathan Rixham , internals@lists.php.net In-Reply-To: References: <01.E6.00959.D3E59574@pb1.pair.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: InterJinn Date: Fri, 07 Dec 2007 11:23:45 -0500 Message-ID: <1197044626.14915.90.camel@blobule> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Subject: Re: [PHP-DEV] Thoughts on Feature Request - Arithmetic From: robert@interjinn.com (Robert Cummings) 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? > > 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! ...........................................................