RE: [PHP] End slash, small problem.
| From: | Mike Brum | Date: | Sat, 03 Jan 2004 01:14:10 +0000 |
| Subject: | RE: [PHP] End slash, small problem. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173662@lists.php.net to get a copy of this message | ||
Do you want code to be handled differently if it's there or do you want it
to be a certain way (e.g. always with trailing slash or never w/ trailing
slash)?
If you want it to always be a certain way, why not grab the last character
of the path, check if it's a slash and then if it's not how you want it to
be, either add the slash or remove it accordingly and then proceed with your
logic.
This will keep your code more precise as you're always acting on a path of a
certain format and you can do your check before that code is executed.
Regards
-M
-----Original Message-----
From: Ryan A [mailto:ryan@coinpass.com]
Sent: Friday, January 02, 2004 8:08 PM
To: php-general@lists.php.net
Subject: [PHP] End slash, small problem.
Hi,
Small problem, I am asking my users to enter a path for something in a
textbox..
eg:
/home/blah/something
am confused as to how I can see if the entered path has an ending slash, if
it has a end slash:
$hasSlash=1 else $hasSlash=0
then i can carry on with my output...
Thanks in advance.
Cheers,
-Ryan
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php