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:[EMAIL PROTECTED] 
Sent: Friday, January 02, 2004 8:08 PM
To: [EMAIL PROTECTED]
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to