Hello,
I'm kind of stuck on a problem right now. I need to find a way to take a string as an expression.
Example:
$num = 4;
$string = "2 * $num + 5";
Is there anyway to evalute $string to return the answer? hopefully without parsing it character by character. =]
I thought of another way by storing the posted string to a file so the file would look like this:
<?php $string = 2 * $num + 5; ?>
I just include the file and it does the trick. This work with me just testing but it won't work well in a multi-user environment due to the file being overwritten before it's recalled by the user needing it.
Thanks in advance,
Chris Jones