Please answer this simple SPAM challenge: two plus five?
(Example: nine)

The Note You're Voting On

ewspencer at industrex dot com
14 years ago
I find using the concatenation operator helps disambiguate value assignments with constants. For example, setting constants in a global configuration file:

('LOCATOR',   "/locator");
define('CLASSES',   LOCATOR."/code/classes");
define('FUNCTIONS', LOCATOR."/code/functions");
define('USERDIR',   LOCATOR."/user");

Later, I can use the same convention when invoking a constant's value for static constructs such as require() calls:


as well as dynamic constructs, typical of value assignment to variables:

= randchar(8,'anc','u');
$usermap = USERDIR."/".$userid.".png";

The above convention works for me, and helps produce self-documenting code.

-- Erich

<< Back to user notes page

To Top