PHP Classes

realpath

Recommend this page to a friend!

      Relative Path  >  All threads  >  realpath  >  (Un) Subscribe thread alerts  
Subject:realpath
Summary:realpath
Messages:2
Author:rudie dirkx
Date:2011-03-19 12:08:33
Update:2011-03-19 12:20:55
 

  1. realpath   Reply   Report abuse  
Picture of rudie dirkx rudie dirkx - 2011-03-19 12:08:33
You do realize there's a single native php function for this? http://php.net/realpath

  2. Re: realpath   Reply   Report abuse  
Picture of Asbjorn Grandt Asbjorn Grandt - 2011-03-19 12:21:05 - In reply to message 1 from rudie dirkx
Yup, I do realize that there is a native function called realpath. However realpath have one major drawback, it requires the path to be resolved to exist on the local system. In addition, it'll also follow symbolic links on systems having those, meaning that ../../some link/somewhere may end up being /var/www/somewhere.
Both issues makes realpath rather useless if you are going to resolve paths into html links that probably does not exist on your system, or if they do, need to be relative. realpath will always return the absolute/canonical path.