-2
$type = 'bravo';

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

This never returns anything. Why this is happening?

LF00
  • 27,015
  • 29
  • 156
  • 295
JDoe
  • 1

2 Answers2

2

Try this:

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

You have to check values individually.

Mayank Pandeyz
  • 25,704
  • 4
  • 40
  • 59
1

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

LF00
  • 27,015
  • 29
  • 156
  • 295