0

Is there a way to use stripslashes() without removing slashes if the string contains a file directory path?

$string = "C:\test\";
echo stripslashes($string);
Cesar Bielich
  • 4,754
  • 9
  • 39
  • 81
  • something like `if(!preg_match('/[a-z]:/i'),$string) {stripslashes(string)}` should work... – Joshua Mar 18 '21 at 22:31
  • How would you know when it's not a directory path? Paths in windows start with `[a-z]:`, by on both Mac and Linux a path can be pretty much anything starting with `/` – Enrico Dias Mar 18 '21 at 23:56

0 Answers0