Re: Checking if

From: Date: Tue, 11 Jan 2005 19:14:36 +0000
Subject: Re: Checking if
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-206099@lists.php.net to get a copy of this message
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. ---------------------------------------------------

« previous php.general (#206099) next »