Say I'm defining a directory and then including files from it. Is it better practice to do:
define('PATH', 'C:/xampp/htdocs/includes/');
require PATH.'header.php;
or:
define('PATH', 'C:/xampp/htdocs/includes');
require PATH.'/header.php;
Say I'm defining a directory and then including files from it. Is it better practice to do:
define('PATH', 'C:/xampp/htdocs/includes/');
require PATH.'header.php;
or:
define('PATH', 'C:/xampp/htdocs/includes');
require PATH.'/header.php;
To avoid ambiguity, you should always add the trailing slash.
Not all files have extensions, so if you use this consistently in your codebase, you (and others) will be able to tell whether a path references a directory or a file at a glance.