-2
if ( in_array( $plink, array( '404', 'sitemap' ) ) ) continue;

I need to invert condition i.e. allowed these values '404', 'sitemap' in loop. Don't exclude / only allow...

Dharman
  • 30,962
  • 25
  • 85
  • 135

2 Answers2

3

For inverting/negation condition use !.

if ( !in_array( $plink, array( '404', 'sitemap' ) ) ) continue;

It's the same principle like you probably know $a != $b.

pavel
  • 26,538
  • 10
  • 45
  • 61
1

use NOT operator to get negation of the condition. See the code below.

if ( !in_array( $plink, array( '404', 'sitemap' ) ) ) {
    echo "do what you want";
}
etution lanka
  • 83
  • 1
  • 11