What is the equivalent of a select() function in PHP for control structures?

The equivalent of a select() function in PHP for control structures is the switch statement. The switch statement allows you to compare a variable against multiple values and execute code based on the matching value. This can be useful for handling multiple cases or options in your code.

$option = "B";

switch ($option) {
    case "A":
        echo "Option A selected";
        break;
    case "B":
        echo "Option B selected";
        break;
    case "C":
        echo "Option C selected";
        break;
    default:
        echo "Invalid option selected";
}