Actually, @ericthelin showed me a neat trick that will allow us to avoid this if statement entirely. We can use [rtrim](http://php.net/rtrim) and pass "/" as the second parameter.

Therefore:
``` php
$path = rtrim('/my/path/', DIRECTORY_SEPARATOR);
```
and
``` php
$path = rtrim('/my/path', DIRECTORY_SEPARATOR);
```
render the same value.

So, we can ditch the full if statement and change this to:

``` php
$path = rtrim($path, DIRECTORY_SEPARATOR);
```