if (stripos($jml['JENIS_TOKO'],'buah') !== false || stripos($jml['JENIS_TOKO'],'bakery') !== false || stripos($jml['JENIS_TOKO'],'roti') !== false) {
Is there any way to shorten this if
condition in PHP? Just like WHERE JENIS_TOKO REGEXP 'buah|bakery|roti'
in SQL.
It's really not a problem if it just 3 like in my example, but I know it won't be effective & the code becomes too long if my substrings is ten or more. (ps: I don't know about regex, but I'm sure that's the clue)
EDIT:
This is not a possible duplicate as alleged. I already check reffered question and see the approved answer, but my case is different. I use bunch of strings, not an array, thus I don't want to use array & foreach
loop unless that is the only way.
I already explain: "Just like WHERE JENIS_TOKO REGEXP 'buah|bakery|roti'
" so I'm sure there's a way to solve this with a regular expression method in single line.