Is the PHP Directory_Separator constant really needed?

A lot of coders use the PHP constant DIRECTORY_SEPARATOR to define paths that will work on Windows as well as other platforms.

However, I read here that is not needed for defining paths because Windows allows for the slashes to be both ways, which was left by Christian here on

(And to be honest, I rarely use the constant because I know this is the case for Windows)

But… what is the uber best practice? According to Jan Jungnickel one SHOULD use it because e.g. Mac OS Classic uses ":" (and see that last wikipedia page for more examples of other operating systems using different variants).

(ofcourse when exploding and parsing you would need it but I'm referring here to defining paths)

So… I come to the conclusion (with as a good example) that it is probably the most elegant and most cross platform to use this constant for defining paths.

But I would gladly hear your comment on that one.

One thought on “Is the PHP Directory_Separator constant really needed?

Please make weblogs less static and interact - initiative (tm) - previously called comments: