Ideal way to define directory separator in PHP

Ideal way to define directory separator in PHP

// Directory separator
if(!defined('DIRECTORY_SEPARATOR')) {
define('DIRECTORY_SEPARATOR', strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/');
} // if

Leave a Reply