Part of the program I am creating consists of the user creating conditions which I will store in a mysql database. I want the syntax to be somewhat easier than what php allows but since this will ultimately be run as php code using eval() it needs to have valid syntax.
For example:
User Input:
4<var1<=9 AND var2<6
Result should be:
4<var1 AND var1<=9 AND var2<6
Before this is eval'd I surround it with an if statement that simply returns true.
What would be a good way to detect and split that comparison up?
Also, how can I test that the resulting code will not cause any php errors so that if it will I can inform the user?
Edit: To be clear those conditions can be any standard conditions such as >,<,>=,<=,==.