NYCPHP Meetup

NYPHP.org

[nycphp-talk] Check for absolute path (cross platform)

Mark Armendariz lists at enobrev.com
Mon Sep 10 13:05:03 EDT 2007


Jakob Buchgraber wrote:
> I wrote a function that searches for a file within the include_path.
> Here it is:
>
>     // check for absolute path
>     if ($path[0] == "/" || $path[1] == ":") {
>         if (file_exists ($path)) {
>             return $path;
>         }
>
>         return false;
>     }

What about
if (str_replace('\\', '/', $path) == str_replace('\\','/', realpath($path)))

Mark



More information about the talk mailing list