Re: define (true/false)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2005-07-28 at 14:41 +0200, Jochem Maas wrote:
> André Medeiros wrote:
> > On Wed, 2005-07-27 at 17:17 -0400, Sebastian wrote:
> > 
> >>i never really used constants before so this may sound stupid..
> >>when you define a constant using define() and want to return true/false 
> >>is this logical:
> >>
> >>if($bars == 3)
> >>{
> >>    define('BAR', 1);
> >>}
> >>
> >>then:
> >>
> >>if(BAR)
> >>{
> 
> ...
> 
> > 
> > 
> > That's an incorrect use for constants. Use variables for that =]
> 
> WHY?
> 
> > 
> 

Well, IMHO, constants have a specific value, for stuff like

define( 'PROJECT_STATUS_PLANNING', 1 );
define( 'PROJECT_STATUS_ACTIVE', 2 );

and

if( $project_stauts == PROJECT_STATUS_PLANNING ) {
}

etc etc.

It just sounds weird...

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux