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

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 vote
Article Rating
Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Pedram Vdl
Pedram Vdl
5 years ago

Hello unfortunately i found this to be incorrect, i was under the same impression as i always use ‘/’ to show the pictures on the website. however under the recent testing of my site i found out that if the computer is windows running on the macbook the separators are ” so i sill advice anyone to use the directory_separator

DMCA.com Protection Status
1
0
Would love your thoughts, please comment.x
()
x