Shorten file path with /../

Published on Tue Mar 01 2022

Example usage: $Path = preg_replace('/(?:^|(?<=\/))(?:[^\s.\/]+|\.(?!\.\/))++\/\.\.\//i', '', $Path);