Submitted by Simon Bauer (not verified) on Mon, 2004-12-06 16:11.
I forgot to mention that he must be totally unaware of preg_replace, which would have saved him lots of lines.
Example from the WTF: $dir=str_replace("\\","/",$dir);
$dir=str_replace("//","/",$dir);
$dir=str_replace("\\\\","/",$dir);
$dir=str_replace("///","/",$dir);
Much better solution: $dir = preg_replace("#[/\\]+#", "/", $dir);
I forgot to mention that he m
Example from the WTF: $dir=str_replace("\\","/",$dir); $dir=str_replace("//","/",$dir); $dir=str_replace("\\\\","/",$dir); $dir=str_replace("///","/",$dir); Much better solution: $dir = preg_replace("#[/\\]+#", "/", $dir);