Hmmm... What if I parse the function and store it as a binary tree with the operators at the root. I can perform an inorder traversal and compute no? Or is there an easier way to do this? John -----Original Message----- From: Jordi Canals [mailto:llistes@xxxxxxxxxxx] Sent: Saturday, April 24, 2004 3:46 PM To: PHP-Windows List Subject: Re: function parser John Yu wrote: > Hi guys > > If I want to input a function (for example x = 2y + 5) and then have it > stored in a database, so next time when I input the values for x and y, I > would like php to retrieve the function and compute it. I know how to store > and retrieve, anyone got any ideas about writing a parser to parse the > function? > > I've wrote parsers under lisp and other languages before just not PHP. If > someone wrote something like this or know of something like this, I'd rather > not have to reinvent the wheel. > > Thanks > John Hi John, Take a look to the eval() function, sure it can help you about this. Hope it helps, Jordi. -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php