3
1
Back

$re = array('#(/\.?/)#', '#/(?!\.\.)[^/]+/\.\./#'); for($n=1; $n>0; $abs=preg_replace($re, '/', $abs, -1, $n)) { } /* replace '//' or '/./' or '/foo/../' with '/' */ } /* dirty.

New Pull Request