php - Using OR in a IF -


any ideas why isn't working?

if($page->slug != 'water-filters' || $page->slug != 'pet-care' || $page->slug != 'books') {   //do  }  

i think mean , instead of or because you're using not equals.

by using not equals in way statement true, if $page->slug equals 'water-filters' doesn't equal 'pet-care' , hence if statement whole returns true.

if($page->slug != 'water-filters' && $page->slug != 'pet-care' && $page->slug != 'books') {     //do  }  

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -