Jump to content

Or expression doenst work


Lisa23

Recommended Posts

No, for at least two reasons.

 

First, you have double-quotes around "home || about || contact". That is checking if $tag is equal to the string 'home || about || contact'

 

Secondly, without the quotes, you would be or'ing home with about and then or'ing that with contact and that as a logic expression is equal to TRUE. So you would be checking if $tag is a TRUE value and that would be true for a lot of different values.

 

Computers don't apply the distributive property to what you write. You must explicitly write out the logic test that you want or find a different method.

 

Since you are testing if something is any one of a list of values, it would be easier to put those values into an array and use the in_array function.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.