Heres what you are after:
$action = 'show';
if ($action == 'show' OR $action == 'edit' OR $action == 'delete') {
echo 'valid actions';
} else {
echo 'Invalid Action';
}
Theres also other possibilities to achieve the same:
$action = 'show';
switch($action) {
case 'show':
case 'edit':
case 'delete':
echo 'valid actions';
break;
default:
echo 'Invalid Action';
break;
}
and..
$action = 'show';
$actions = array('show','edit','delete');
if (in_array($action,$actions)) {
echo 'valid actions';
} else {
echo 'Invalid action';
}
Second one(switch statement) is the best way because you'll probably do more than just print 'valid actions':
$action = 'show';
switch($action) {
case 'show':
// code for the show
break;
case 'edit':
// code for the edit
break;
case 'delete':
// code for the delete
break;
default:
echo 'Invalid Action';
break;
}