DEV Community

loading...

Discussion on: Always use `/` as directory separator in php

c33s profile image
Julian Author

that sounds odd... of course a thing to keep in mind.

But so far I think for directory separator purposes using DIRECTORY_SEPARATOR is safer.

not sure if you can generalize that. as i wrote in my post, people are using the DIRECTORY_SEPARATOR and it happened to me more than once, that the well-intentioned DIRECTORY_SEPARATOR simply broke stuff.
of course you arguments are really good ones, i simply try to balance what happens more often, a special encoding which is known to break things or a DIRECTORY_SEPARATOR which is used wrong because it can't be tested on linux systems.

Thread Thread
shipman profile image
jon™

But you shouldn't use DIRECTORY_SEPARATOR on urls, hence your "simply broke stuff" issue.

It's like using move_uploaded_file to move file A.txt to B.txt, it simply won't work.