RE: [PHP] End slash, small problem.
| From: | Ryan A | Date: | Sat, 03 Jan 2004 01:23:00 +0000 |
| Subject: | RE: [PHP] End slash, small problem. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-173663@lists.php.net to get a copy of this message | ||
Hi,
Thanks for replying.
Basically after that path I am adding a file "ryanFile.php" so I need that
ending slash to always be in the path
My question was exactly that...how do I "grab" the last character?
Thanks,
-Ryan
On 1/3/2004 2:14:10 AM, Mike Brum (php@crazyted.com) wrote:
> 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