In PHP I'm receiving a string from the user for a local file directory $path
I want to know if they've included the trailing slash (/) or not. I would like this to be cross platform so I'd like to use the PHP constant DIRECTORY_SEPARATOR
My failed attempts include trying to do a preg_match like
preg_match("/" . DIRECTORY_SEPARATOR . "$/", $path);
I basically just want an elegant way to test if the string ends with the DIRECTORY_SEPARATOR
.