[thelist] Directory names

Guy Bowden guy at holler.co.uk
Tue Nov 25 15:54:57 CST 2003

Cheers for that. I was presuming that PHP would have a nifty function :)

If not, I'll do the find/replace way.

Is there any real problem with leaving it in there?

-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Joshua Olson
Sent: 25 November 2003 19:26
To: thelist at lists.evolt.org
Subject: Re: [thelist] Directory names

----- Original Message ----- 
From: "Guy Bowden" <guy at holler.co.uk>
Sent: Tuesday, November 25, 2003 1:37 PM

> If I've got a folder string in PHP like this:
> /546/guy/datasrc/./../email/sendtofriend/
> How can I turn that into :
> http://darkside/546/guy/email/sendtofriend/
> In php?

I don't do PHP but here's the programming approach I'd start with:

1.  Replace all instances of '/./' with '/'
2.  Break the string into an array using '/' as the delimiter. 3.  Loop
through the array once and append '/' to the end of every element unless the
next non-empty element is '..', in which case you clear the array element
and the next non-empty element (which should be '..'). 4.  Rejoin the array
into a single string ensuring that the empty string is used as the

Good luck,

Joshua Olson
Web Application Engineer
WAE Tech Inc.

* * Please support the community that supports you.  * *

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 

More information about the thelist mailing list