RE: Re[2]: [PHP] End slash, small problem.
| From: | Chris | Date: | Sat, 03 Jan 2004 06:50:44 +0000 |
| Subject: | RE: Re[2]: [PHP] End slash, small problem. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173675@lists.php.net to get a copy of this message | ||
You forgot to double slash the windows slash like: '\\'
I would write that same functionality as follows:
$sep = (PHP_OS == 'Windows')? '\\':'/';
if(substr($template_path,-1) == $sep)) $template_path .= $sep;
-----Original Message-----
From: Tom Rogers [mailto:trogers@kwikin.com]
Sent: Friday, January 02, 2004 7:24 PM
To: Ryan A
Cc: php@crazyted.com; php-general@lists.php.net
Subject: Re[2]: [PHP] End slash, small problem.
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php