yes you are right.
Has someone did it ?
BODMAS excercises?
http://www.abacustraining.biz/bodmasExercises.htm
What is an example of what the user exactly entering...
This:
OR
This:
are you verifing the "syntax", IOW making sure the parenthesis are matched up and return a true or false,
or do you need to calculate the expression and give the a number result? or perhaps compare it with your number to see if correct?
If you're looking for the first example, then all you need to do is search for parenthesis. count all the left parenthesis and count all the right parenthesis, if the numbers don't match, they left a parenthesis out and their syntax is incorrect.
if second example, then use eval();
if using eval() BE VERY CAREFUL to filter the content, otherwise i can execute any PHP code on your Site!!
for example, use regex to check for characters other than -,+,*,/ 0-9 and a-z;
no semi-colon in content given to eval() should make it a litte safer. maybe user str_replace() and replace all semi-colons with an empty string.
Good luck,
Dan