Skip to content

DIRECTORY_SEPARATOR is not necessary in PHP?

In Linux, the path separator is /, in windows supports both / and , so you can just use forward slashes to make your script cross-platform(Linux, UNIX, Mac OS X). instead of using DIRECTORY_SEPARATOR

Christian :
I just learned that, to specify file names in a portable manner, you DON’T need ‘DIRECTORY_SEPARATOR’ – just use ‘/’. This really surprised and shocked me, as until now I typed about a zillion times ‘DIRECTORY_SEPARATOR’ to stay platform independent – unnecessary. Don’t make the same mistake.

php.net

0 0 votes
Article Rating
Subscribe
Notify of
guest

1 Comment
Most Voted
Newest Oldest
Inline Feedbacks
View all comments