How to optimize the IF condition with many conditions and same output [closed]

Sure

You could use in_array for this type of check, something like this

if (in_array($string, ['apple', 'banana', 'kiwi'])) { // keep adding as many as you need
    $Detail = false;
    $bShowNew = true;
}

If your array gets to big you can create a variable that will contain that array

$allowed = [
    'apple',
    'banana',
    'kiwi'
    // etc... 
];

if (in_array($string, $allowed)) { // keep adding as many as you need
    $Detail = false;
    $bShowNew = true;
}

This will do exactly the same but is a bit cleaner and easier to read