Don’t Use PHP for Browser Detection (for CSS) | Impressive Webs
Server-side browser detection via user agent sniffing is problematic for several reasons: user agents can be spoofed or altered, making detection unreliable, and since browser compatibility issues are presentational concerns, they should be handled with client-side CSS and HTML rather than mixing presentation logic into server-side code. Additionally, this approach creates maintenance nightmares by hiding styling fixes in backend code where future developers won't look for them, and it requires constant updates as browsers evolve and change their identification strings.