Re: benefit of constants

From: Date: Fri, 02 Mar 2001 21:07:07 +0000
Subject: Re: benefit of constants
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-42395@lists.php.net to get a copy of this message
At 12:48 PM 03/02/2001 -0700, Joe wrote:
is there any real benefit to declaring a CONSTANT over just defining a variable?
The fact they can't be overwritten makes them more appropriate for true constants, absolutely no way to change their values. I frequently use them in include files to set widths, etc., that are brought into all the pages in a project. Plus, they have global scope - great if you are in the habit of forgetting global declarations in functions <g>. And my guess is their is less overhead in using them, even in an interpreted environment.

« previous php.general (#42395) next »