PHP Logical operators -


i have weird syntax issue. can tell me why isn't working:

if ( ! is_single() || ! is_archive() )

but is: if ( ! is_single() || is_archive() )

and how first statement work? in advance!

edit: still editing question when answer came. anyway, should have mentioned meant syntax. aware logic of 2 statements not same. ! has put outside. guys.

! (negate) operator has higher precedence in php. why need enclose second expression in brackets:

if ( ! (is_single() || is_archive()) ) 

to work you're expecting.


Comments

Popular posts from this blog

design - Custom Styling Qt Quick Controls -

Unable to remove the www from url on https using .htaccess -