ummmm NOPE...
i don't believe that nick was looking for a constant - which cannot be
changed once defined.

there are a few ways to do this - for one, you can declare $var global
inside of the function in your class:

class myclass{

  function myclass(){
    global $var;
    //do some stuff
  }
}

when you invoke a class instance with a function that shares the same name
as the calling class it executes automatically.  by declaring this $var
global it should be accessible to the rest of the functions.

another way to do this without declaring the $var as a global is to pass it
to the function explicitly:

function myclass($var){
  //do stuff with $var
}

~Phillip Jackson

"Nick Wilson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> * and then Nick Wilson declared....
> > <?php
> > $myconfig=TRUE;
> >
> > class myclass {
> >
> >     if($myconfig) {
> >         var $something=1;
> >     }
> > }
> >
> > I know that that is not the way it should be done though. What is the
> > best way to do this?
>
> On a hunch, i think i've found the answer:
> http://www.php.net/manual/en/language.constants.php
>
> Right?
>
> -- 
> Nick W

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

Reply via email to