Shane Larson
Shane Larson

Reputation: 15

PHP Constant Question

What is the

DIRECTORY_SEPARATOR

constant contain?

I can't find anything on google explaining this but its used in my OOP book.

Upvotes: 0

Views: 84

Answers (3)

Bojangles
Bojangles

Reputation: 101533

It's sort of on the tin.

When I run

var_dump(DIRECTORY_SEPARATOR);

I get (on my Linux/Ubuntu box)

string(1) "/" 

(A forward slash). This is the separator string that applies to file paths on the OS your server is running on. It will most probably be a \ (backslash) on Windows systems.

Upvotes: 0

Leto
Leto

Reputation: 2674

It is the separator that link folder in a path like "/" in :

here/is/my/path

The separator depends on which OS you are running your website.

On windows, this is "\" :

my\path\to\folder

On Unix it's "/"

Upvotes: 2

christopher_b
christopher_b

Reputation: 958

Either '/' or '\' depending on your OS. Use it when specifying paths to make code more portable between Unix-y systems and Windows.

Upvotes: 1

Related Questions