This is a discussion on Handle String-Variable as mathematical order within the PHP Language forums, part of the PHP Programming Forums category; Hi there, i just wondered if it is possible to handle a string variable as a mathematical order. If the ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi there,
i just wondered if it is possible to handle a string variable as a mathematical order. If the variable contains i.e. "2*100" PHP should calculate it, so that i'm able to assign the the result to another variable. How can i realise this if it is possible Thanks for the help, Johannes |
|
|||
|
"MatrixCrawler" <j.brunswicker@t-online.de> wrote in message
news:cl5u81$d5t$03$1@news.t-online.com... > Hi there, > > i just wondered if it is possible to handle a string variable as a > mathematical order. > > If the variable contains i.e. "2*100" PHP should calculate it, so that i'm > able to assign the the result to another variable. > How can i realise this if it is possible > > > Thanks for the help, > Johannes > > Tested: <?php $math = "2*100"; eval("\$math2 = $math;"); print $math2; ?> |