Is it more efficient to create separate pages for different user groups or use if/else statements to control access on a single page in PHP?

It can be more efficient to use if/else statements to control access on a single page in PHP rather than creating separate pages for different user groups. This approach reduces code duplication and makes it easier to manage permissions and access control.

<?php
$userGroup = "admin"; // Example user group

if ($userGroup == "admin") {
    // Code for admin users
    echo "Welcome, admin!";
} else {
    // Code for other user groups
    echo "Access denied.";
}
?>