What are the potential pitfalls of using substr($_SERVER['REQUEST_URI'],0,-1) to set the active class?

Potential pitfalls of using substr($_SERVER['REQUEST_URI'],0,-1) to set the active class include the possibility of removing the last character of the URL, which could lead to incorrect matching and styling of the active navigation item. To solve this issue, it is recommended to use the PHP function rtrim() instead, which specifically removes trailing characters from a string.

<?php
$current_url = rtrim($_SERVER['REQUEST_URI'], '/');
?>