abdul raziq
abdul raziq

Reputation: 859

php set_include_path function confusion?

i have already searched internet and (php mannual too a little hard to understand) but didn't get satisfied about php's set_include_path, i know that its used to set the include path for the running script,but i dont quit understand what does PATH_SEPARATOR constant do in php set_include_path function.

so for example

set_include_path('./php-include'.PATH_SEPARATOR.'./functions');

i don't quiet get it please some one explain it thanks in advance.

Upvotes: 1

Views: 198

Answers (2)

T0xicCode
T0xicCode

Reputation: 4951

PHP's include path can have multiple directories, that are searched in order for the file you are trying to include. The way that was chosen to list many directories is to separate the directories with a character that they know will never appear in a directory's name.

For instance, on Windows, ; is such character. So, when PHP needs to find a file, it can simply split the string representing the various include paths on each occurrence of the ; character and search for the file in each of the directories.

Upvotes: 1

Pat Butkiewicz
Pat Butkiewicz

Reputation: 683

PATH_SEPARATOR is the character that's used to separate multiple paths in a string, such as the include_path.

On Unix, PATH_SEPARATOR is ':' while on Windows it's ';'

Upvotes: 1

Related Questions