-2
$type = 'bravo';

if ($type === ('alpha' || 'bravo')) {
    echo $type;
}

This never returns anything. Why this is happening?

LF00
  • 24,667
  • 25
  • 136
  • 263
JDoe
  • 1

2 Answers2

2

Try this:

if ($type === 'alpha' || $type === 'bravo') {
    echo $type;
}

You have to check values individually.

Mayank Pandeyz
  • 24,624
  • 3
  • 35
  • 55
1

'alpha' || 'bravo' is boolean true not string 'bravo'

LF00
  • 24,667
  • 25
  • 136
  • 263