How to get real path to a file in PHP, but WITHOUT following links?
<p>PHP has a nice <code>realpath()</code> function, which can convert something like <code>/dir1/dir2/../dir3/filename</code> to <code>/dir1/dir3/filename</code>. The "problem" with this function is that in case <code>/dir1/dir3/filename</code> is not an actual file but merely a link to another file, PHP would follow that link and return the real path of the actual file.</p>

<p>However, I actually need to get the real path of the link itself. All I need is to resolve complexities like <code>/dir/..</code> in the path. How can I do it?</p>
