hex1a4
01-16-2008, 09:24 AM
Hi,
All I want to do is check if the last character of a string is a forward slash ('/') and based on the result assign a value to a variable. This is how I'm doing it:
$n=(substr($row[url],0,strlen($row[url])-1)=="/") ? 8 : 7;
For URLs with a trailing slash $n should be 8, but regardless of whether or not the URL has a trailing forward slash $n is always 7. Why is that?
All I want to do is check if the last character of a string is a forward slash ('/') and based on the result assign a value to a variable. This is how I'm doing it:
$n=(substr($row[url],0,strlen($row[url])-1)=="/") ? 8 : 7;
For URLs with a trailing slash $n should be 8, but regardless of whether or not the URL has a trailing forward slash $n is always 7. Why is that?