Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

wwwxxx0cm, www.webdp.net, Event 9 IIS log failed to write entry, wwwxxx jeffs, Catastrophic failure Unexpected method call sequence. 0x8000ffff (-2147418113)., ksh lock a file, [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_DBC failed, sed: -e expression #1, char 1: unterminated address regex, procmail + change subject, w2ksp4.exe download

Links

XODOX
Impressum

#1: Filesystem path creation function

Posted on 2010-10-05 10:07:33 by unknown

Post removed (X-No-Archive: yes)

Report this message

#2: Re: Filesystem path creation function

Posted on 2010-10-05 13:34:54 by Richard Quadling

On 5 October 2010 09:07, Gary <php-general@garydjones.name> wrote:
> Does such a thing exist in php? My searches have lead nowhere.
>
> What I am looking for is a function which you would pass two parts of a
> path to (which might be a directory and a filename, say) and it would
> return a string containing the parameters separate by the correct number
> of path separators according to the current OS.
>
> For example:
>
> <?php
> $d = 'foo';
> $f = 'bar';
> $path = createPathString($d, $f);
> ?>
>
> Would result in 'foo\bar' (Windows), 'foo/bar' (*n*x).
>
> And
> <?php
> $d = 'foo/'; // note the trailing slash
> $f = 'bar';
> $path = createPathString($d, $f);
> ?>
>
> on *n*x would also result in 'foo/bar' (i.e. the path would only contain
> one "/").
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Yep.

function createPathString($d, $f){return $d. DIRECTORY_SEPARATOR . $f;}




--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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

Report this message

#3: Re: Filesystem path creation function

Posted on 2010-10-05 13:36:04 by Richard Quadling

On 5 October 2010 09:07, Gary <php-general@garydjones.name> wrote:
> Does such a thing exist in php? My searches have lead nowhere.
>
> What I am looking for is a function which you would pass two parts of a
> path to (which might be a directory and a filename, say) and it would
> return a string containing the parameters separate by the correct number
> of path separators according to the current OS.
>
> For example:
>
> <?php
> $d = 'foo';
> $f = 'bar';
> $path = createPathString($d, $f);
> ?>
>
> Would result in 'foo\bar' (Windows), 'foo/bar' (*n*x).
>
> And
> <?php
> $d = 'foo/'; // note the trailing slash
> $f = 'bar';
> $path = createPathString($d, $f);
> ?>
>
> on *n*x would also result in 'foo/bar' (i.e. the path would only contain
> one "/").
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

http://www.php.net/manual/en/dir.constants.php

--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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

Report this message

#4: Re: Filesystem path creation function

Posted on 2010-10-05 14:17:53 by unknown

Post removed (X-No-Archive: yes)

Report this message