Re: Accessing a variable from inside a local function

From: Date: Wed, 28 Jul 2004 11:37:33 +0000
Subject: Re: Accessing a variable from inside a local function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192086@lists.php.net to get a copy of this message
Something like this is probably better handled by a class. Then you can access class properties to do what you want. Class yourclass { function foo() {
    $this->my_foo_local = 10;
} function bar($var_bar) {
    return $this->my_foo_local+$var_bar+1;
} } $object = new yourclass(); $object->foo(); echo $object->bar(12);

« previous php.general (#192086) next »