What are the advantages and disadvantages of implementing a PHP-based browser switch for CSS display instead of relying on JavaScript detection?

When implementing a PHP-based browser switch for CSS display instead of relying on JavaScript detection, one advantage is that PHP is server-side, meaning that the display will be consistent across all users regardless of their browser settings. Additionally, PHP can provide better performance as it does not rely on client-side processing. However, a disadvantage is that PHP may not be as flexible or dynamic as JavaScript for certain browser-specific functionalities.

<?php
$user_agent = $_SERVER['HTTP_USER_AGENT'];

if (strpos($user_agent, 'MSIE') !== false || strpos($user_agent, 'Trident') !== false) {
    echo '<link rel="stylesheet" type="text/css" href="ie.css">';
} else {
    echo '<link rel="stylesheet" type="text/css" href="style.css">';
}
?>