What is the point of using DIRECTORY_SEPARATOR over "/" in php

Why should I use . DIRECTORY_SEPARATOR .

instead . "/" .

?

My initial thought was that there might be a different separator instead of the forward slash, but if I am designing, say, a Wordpress plugin, can I assume there is always / separating two folders?

+1


source to share


1 answer


If the application will run on different operating systems, the directory will not always be a forward slash. This is a backslash on Windows, for example.



Newlines are a similar case. This is \n

on * nix, \r\n

on Windows, etc. Therefore there is PHP_EOL

.

+9


source







All Articles