I have these 2 snippets of code that I have been playing with, but can\'t seem to get the logic to stick in either of them.
I am trying to see if a given string has
You are just using substr wrong.
To get the last character you have just use negative offset: substr($path,-1)
Your code lacks 2 fundamental things, essential for the programming:
Debugging is as simple as just echoing your variables.
by echoing substr($path, 0, -1) you can make yourself aware that your code is somewhat wrong and by reading documentation you can see the right usage.