[PHP] Re: How to convert a string into a mathematical expression?

2001-07-13 Thread Philip Hallstrom

Take a look at the eval() function.

On Fri, 13 Jul 2001, Christodoulou Demetris wrote:

  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]



-- 
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] Re: How to convert a string into a mathematical expression?

2001-07-13 Thread scott [gts]

be *extremely* careful.  eval() is like spawning another PHP
interpreter... it'll execute *any* code that you give it.

people could type in unlink(); and such commands and really
trash your webserver.

 -Original Message-
 From: Philip Hallstrom [mailto:[EMAIL PROTECTED]]
 Subject: [PHP] Re: How to convert a string into a mathematical
 expression?
 
 Take a look at the eval() function.
 


-- 
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]