I'm putting together a search form. I want to provide the user the option of searching with logical operators. Examples of search queries:
red || ((green && pink))
!red && !green
The data which is being searched is stored in an array. I have a few ways I can provide this functionality by chopping the search string up but I'm wondering if anyone knows of any modules which I could utilize before is start coding something from scratch?
I should also mention that I'm aware of security issues surrounding techniques but I'm not worried about SQL injections etc. as this tool isn't going to be on a public facing server.
Look into using a proper Lexer or PEG, such as php-peg or PHP_LexerGenerator, which allows you to generate code that parses and validates a grammar for such uses.
You might also want to look at tools like ANTLRWorks, helping debugging and creating grammars.
Your question is a little vague but I think that eval() could be used to easily solve your problem, if you don't know it executes code that you give it as a string.