DIRECTORY_SEPARATOR vs '/'

Is DIRECTORY_SEPARATOR necessary ?
Is using ‘/’ enough ?
I heard even Windows treats ‘/’ well.
Which one do you prefer ? The 19-character DIRECTORY_SEPARATOR or 3-character ‘/’ ?
Please tell me why if you prefer DIRECTORY_SEPARATOR :smile:

First I’ve heard of it, but it would be nice if true. Where did you hear it? Limited versions?

Does this mean we can lose PHP_EOL too?

Personally, 19 characters, 3 characters, meh, what’s the difference in terms of performance vs code reliability.

I heard it from http://alanhogan.com/tips/php/directory-separator-not-necessary
PHP_EOL is still necessary since Windows use ‘\r\n’, but others use ‘\n’

Thanks

from 2008 it seems like it must be good for at least since Windows7

1 Like

Yes, using / is enough so long as you’re not running production windows servers. Anyone who needs to run the site on a local machine should be using vagrant or docker anyway.

Wait, wait, wait… wait…

People actually use IIS to run PHP? It’s amazing enough that anyone uses IIS to start with.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.