0 && count($link) > 0 && reset($target) == reset($link)) { $cwd[] = array_shift($target); array_shift($link); } // Compute the required relative path if (count($link) > 1) $target = array_merge(array_fill(0, count($link) - 1, '..'), $target); $link = array_merge($cwd, $link); } return symlink(implode('/', $target), implode('/', $link)); } //////////////////////////////////////////////////////////////////////////////