php - Splitting a string up into parts -


I have a list of questions in the table, some of which are only for display if some criteria are found. Criteria in one record can be as simple as 4002 = Y, where 4002 is a question number and Y is the answer. If 4002 = yes the question is to be displayed.

I have no problem with the only one criteria for the record.

But there are such records which are the following criteria:

  402 = y or 7003 = y or 905 = y or 7007 = y or 7008 = y or 7010 = or Or 7011 = y or 7013 = y  

In this case, I will need to evaluate each option to see whether the question should be displayed or not.

Other questions will have the same string; Some small, some tall

How would I break the best string so that I can evaluate each section at a time and still be able to compare them correctly?

I do some extent data, but I do not want that if possible.

Is this a regex () task (I'm not yet familiar with it)? I have tried list () , split () and explosion () with less success.

Any indication if your input string is actually a bunch of different simple criteria with "OR", then appreciate it. A simple explosion will actually move:

  $ criteria = "402 = Y or 7003 = Y or 905 = Y or 7007 = Y or 7008 = Y or 7010 = Y or 7011 = Y or 7013 = Y "; $ Split_criteria = Explosion ("or", $ criteria); Foreign currency ($ split_criteria as a single) {echo trim ($ single) "\ N"; }  

However if it is more complex (if you allow or simultaneously, or if you say so) you will need to have more sensible parsets accordingly.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -