I have a list of questions in a table, some of which are only to be displayed if certain criteria are met. A record might have criteria as simple as 4002=Y where 4002 is the question number and Y is the answer. If 4002=Y then the question is to be displayed.
For records with only one criteria I have no problem.
But then there are records that have criteria like the following:
402=Y OR 7003=Y OR 905=Y OR 7007=Y OR 7008=Y OR 7010=Y OR 7011=Y OR 7013=Y
In this case I would need to evaluate each option to see if the question is to be displayed or not.
Other questions will have similar strings; some shorter, some longer.
How would I best split the string up so I can evaluate each section at a time and still be able to compare them correctly?
I can reformat the data to some degree, but I would prefer not to if at all possible.
Is this a regex()
task (I'm not very familiar with that yet)? I've tried list()
, split()
and explode()
with little success.
Any pointers would be appreciated.