$path = \'/home/to//my///site\';
I am trying to remove unnecessary forward slashes / from the path above
/
I am trying to get this
while(strlen($path) != (strlen($path = str_replace('//','/', $path))));
This code replaces double slashes with single slash, as long as it changes length;