Posted by Ben Ramsey on 10/04/76 11:05
Bruno B B Magalhães wrote:
> how to determine if the last char of a string is a '/'...
>
> The problem, a webpage can be accessed by www.domain.com/page.php or
> www.domain.com/page.php/
Use substr()...
http://www.php.net/substr
$url = 'http://example.com/index.php/';
if (strcmp(substr($url, -1), '/') == 0) {
// it ends with a '/'; strip it off
$url = substr($url, 0, -1);
}
--
Ben Ramsey
Zend Certified Engineer
http://benramsey.com
---------------------------------------------------
Atlanta PHP - http://www.atlphp.org/
The Southeast's premier PHP community.
---------------------------------------------------
[Back to original message]
|