Home  >  Article  >  Backend Development  >  Is the directory separator in PHP really unnecessary?

Is the directory separator in PHP really unnecessary?

WBOY
WBOYOriginal
2016-08-18 09:16:171092browse

Windows accepts / and
*unix systems accept /

If we use / uniformly, there is no need to use directory separator

See two articles saying it’s unnecessary: ​​

http://alanhogan.com/tips/php...

http://us2.php.net/manual/en/...

Confirm, is it really unnecessary?

Reply content:

Windows accepts / and
*unix systems accept /

If we use / uniformly, there is no need to use directory separator

See two articles saying it’s unnecessary: ​​

http://alanhogan.com/tips/php...

http://us2.php.net/manual/en/...

Confirm, is it really unnecessary?

Anyway, the paths I encountered are all unified/, and I haven’t found any problems so far

I don’t think it’s necessary. PHP_EOL is still useful. I don’t know what is the purpose of defining a DS for each project. .
Here is a reason that sounds reasonable: This is a good coding habit, just like writing <?php even if the short tag is enabled.

At the end of the first article you gave, you mentioned that when you need to use the explode function to split the path, you need this DS

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn