Re[2]: [PHP] End slash, small problem.
| From: | Tom Rogers | Date: | Sat, 03 Jan 2004 03:23:33 +0000 |
| Subject: | Re[2]: [PHP] End slash, small problem. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173668@lists.php.net to get a copy of this message | ||
Hi,
Saturday, January 3, 2004, 11:23:00 AM, you wrote:
RA> Hi,
RA> Thanks for replying.
RA> Basically after that path I am adding a file "ryanFile.php" so I need that
RA> ending slash to always be in the path
RA> My question was exactly that...how do I "grab" the last character?
RA> Thanks,
RA> -Ryan
I do it like this:
$sep = (PHP_OS == 'Windows')? '\':'/';
$template_path .= (substr($template_path,-1) == $sep)? '':$sep;
--
regards,
Tom