update page now
Longhorn PHP 2026 - Call For Papers

Voting

: zero minus zero?
(Example: nine)

The Note You're Voting On

Ray.Paseur often uses Gmail
11 years ago
It's worth noting that PHP provides an OS-context aware constant called DIRECTORY_SEPARATOR.  If you use that instead of slashes in your directory paths your scripts will be correct whether you use *NIX or (shudder) Windows.  (In a semi-related way, there is a smart end-of-line character, PHP_EOL)

Example:
<?php 
$cfg_path
= 'includes'
. DIRECTORY_SEPARATOR
. 'config.php'
;
require_once($cfg_path);

<< Back to user notes page

To Top