Reputation: 1329
For example, next 2 vars give a link to same directory, but strings are different.
How can I detect they means same directory?
$dir1 = 'application/somedir/some_subdir/../';
$dir2 = 'application/somedir/';
Upvotes: 0
Views: 159
Reputation: 46060
Use realpath()
if (realpath($dir1) == realpath($dir2)) {
do_stuff();
}
See http://php.net/manual/en/function.realpath.php
You may also want to check that the directories exists before use it.
Upvotes: 10