Re: how to make a class to ember you variables?
| From: | Robin Vickery | Date: | Thu, 24 Aug 2000 08:53:18 +0000 |
| Subject: | Re: how to make a class to ember you variables? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13332@lists.php.net to get a copy of this message | ||
maxim.maletsky@lincmedia.co.jp (Maxim Maletsky) writes:
> ------_=_NextPart_001_01C00DA2.04885340
> Content-Type: text/plain;
> charset="iso-8859-1"
>
>
> Now, after the func1() was executed I want to remember it's returned value
> and use it within the same class but in a different function func2(); which
> will be called somewhere later on the same script.
>
Replace $v1 and v2 with $this->v1 and $this->v2 like so:
class MyClass {
var $v1;
var $v2;
function WhatEver() {
whatever;
whatever;
return $whatever;
}
function Func1() {
$this->v1 = ($this->WhatEver());
return $this->v1;
}
function Func2() {
$this->v2 = ($this->WhatEver());
return $this->v2;
}
function myResult() {
$myResult = ($this->v2 - $this->v1)*100;
return $myResult;
}
}
--
Robin Vickery...............................................
Planet-Three, 3A West Point, Warple Way, London, W3 0RG, UK
Email: robin@planet-three.net Phone: +44 (0)870 729 5444