This would depend on the format. For example, it can't calculate "x", as its not defined in PHP. However, you sould be able to do something like: eval("\$math = $expression;"); ...and it should work. The main problem with this is that unless you can 100% trust the user who's inputing data, its a major security problem. If you can't, you'd have to develop your own parser for processing the data. /* Chris Lambert, CTO - [EMAIL PROTECTED] WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */ ----- Original Message ----- From: Christodoulou Demetris <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, July 13, 2001 7:09 AM Subject: [PHP] How to convert a string into a mathematical expression? Hi list. I have string variables that contain mathematical expressions. These strings are submitted through forms. For example if a user inserts the following-> 1+cos(0.3)*x into a text field with name expression in an HTML form then what i get on the server is the string variable $expression whose values is "1+cos(0.3)*x" Is there a way to convert the string variable, $expression, into a mathematical expression that can be calculated? Thanks in advance. DX. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How to convert a string into a mathematical expression?
Chris Lambert - WhiteCrown Networks Fri, 13 Jul 2001 03:57:36 -0700
- [PHP] How to convert a string into a m... Christodoulou Demetris
- [PHP] Re: How to convert a string... Philip Hallstrom
- RE: [PHP] Re: How to convert ... scott [gts]
- [PHP] How to convert a string int... Christodoulou Demetris
- Chris Lambert - WhiteCrown Networks