I run PHP on my Windows 7 dev box. I've noticed that paths produced from the $_SERVER
array always use forward slashes, whereas other sources such as __FILE__
use back slashes.
Now, I'm assuming that the $_SERVER
derived paths are forward slashed because they're generated by the Apache binaries, whereas __FILE__
, et al., produce back slashes because they're hitting the OS for path info.
My question is, is there any other rhyme or reason? I'm not a fan of DIRECTORY_SEPARATOR
and am currently just running $path = strtr($path, '\\', '/');
on everything. I just don't want to be doing it for nothing, or not doing it when I should.