View Single Post
Old 03-18-2008, 12:51 AM   #1 (permalink)
TerrorRonin
The Contributor
 
Join Date: Dec 2007
Posts: 31
Thanks: 0
TerrorRonin is on a distinguished road
Default DIRECTORY_SEPARATOR not necessary

In attempting to write cross-platform, portable PHP engine, I was using PHP's DIRECTORY_SEPARATOR constant to write path strings(eg ".." . DIRECTORY_SEPARATOR . "foo.php", because the proper way to write it in Windows would be "\" while in Unix it would be "/".

Well, an engineer from php.net pointed out to me that, and a few other programmers confirmed that using that constant is completely unnecessary. As long as you use the forward slash (/), you'll be fine. Window's doesn't mind it, and it's the best for *nix operating systems.

(Note that DIRECTORY_SEPARATOR is still useful for things like exploding a path that the system gave you.)

Hope this is useful to people.
TerrorRonin is offline  
Reply With Quote
The Following 4 Users Say Thank You to TerrorRonin For This Useful Post:
Alan @ CIT (03-18-2008), DeMo (03-18-2008), sjaq (03-18-2008), Wildhoney (03-18-2008)