...

View Full Version : Resolved DIRECTORY_SEPARATOR v. PATH_SEPARATOR



cfructose
03-30-2010, 01:33 PM
Is there any difference between DIRECTORY_SEPARATOR and PATH_SEPARATOR ?

I can't find any documentation that clarifies this.

Oh, and a follow-up question:
When defining absolute paths as constants, am I correct in saying that Windows will handle the Unix separator just fine, and that DIRECTORY_SEPARATOR is therefore redundant for portability purposes; a simple forward slash will suffice?

xconspirisist
03-30-2010, 02:16 PM
Indeed there is.

DIRECTORY_SEPARATOR is to separate directories within a path. On linux it is /


/var/www/myfile

PATH_SEPARATOR is to separate paths within a string. On linux it is a colon ( : ). An example of where you would want to do this is set_include_path() (http://uk3.php.net/set_include_path). On windows I think it is a semicolon ( ; ).


/var/www/myfile:/home/myfile:/tmp/myfile

cfructose
03-30-2010, 03:12 PM
Wow, I'd completely misunderstood that.

Thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum