Is there a way to convert a path that looks like ../../../ into path/path/path, I want to make a search class but got to thinking that anyone could pass in the ../ format instead of path/ and return a list of the files that are found.
I started to approach this by using preg_replace() to find and replace everything up until it matches the $_SERVER['DOCUMENT_ROOT'] in the path being passed. But the only solves the path/path/path problem.
How would I approach the ../../../ problem?
What about realpath?
http://php.net/manual/en/function.realpath.php