Always use a strict comparison for `strpos`, as it returns `0` if the subject begins with the string. Also, I'd use:

```php
if (strpos($path, '//') === false)
{
    return rtrim($path, '/');
}
```