What are some potential pitfalls to consider when using switch statements in PHP to display different page content based on user input?

One potential pitfall when using switch statements in PHP to display different page content based on user input is forgetting to include a default case. This can lead to unexpected behavior if the user input does not match any of the cases. To prevent this, always include a default case that handles any unexpected input.

$user_input = $_GET['page'];

switch($user_input) {
    case 'home':
        include 'home.php';
        break;
    case 'about':
        include 'about.php';
        break;
    default:
        include 'error.php';
}