Re: How to check if something is a sub-directory?
- From: "Rik Wasmus" <luiheidsgoeroe@xxxxxxxxxxx>
- Date: Fri, 29 Feb 2008 01:10:00 +0100
On Fri, 29 Feb 2008 00:44:18 +0100, laredotornado@xxxxxxxxxxx <laredotornado@xxxxxxxxxxx> wrote:
Hi,
Is there a more sophisticated way, beyond the "strstr" function, to
check if $dir1 is a sub-directory of $dir2, both being strings? You
may assume that both are absolute paths.
If it is direct 'descendant':
$is_subdir = realpath($dir1.'/..') == realpath($dir2);
If not, still apply realpath, but check with either a regex or a substring that the 'parent'-path is indeed at the START of the 'child'-path.
--
Rik Wasmus
.
- References:
- How to check if something is a sub-directory?
- From: laredotornado@xxxxxxxxxxx
- How to check if something is a sub-directory?
- Prev by Date: How to check if something is a sub-directory?
- Next by Date: Re: template sctipt execution time
- Previous by thread: How to check if something is a sub-directory?
- Index(es):
Relevant Pages
|