Hello Toro,

Tuesday, February 24, 2004, 12:22:29 AM, you wrote:

TH> Hi all.
TH> I was wondering if using defined constants in class definitions
TH> is completely legal (or even good practice) in PHP.

I see absolutely no reason why not. Constants are just ways of
defining non-changing variables, there is nothing about them that
controls where they apply (i.e. their scope) and if anything the PHP
manual itself backs up the fact you can use them in a class:

"Like superglobals, the scope of a constant is global. You can access
constants anywhere in your script without regard to scope."

Global to me means what it says - global. In a class, a function, an
include, whatever.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to