Entry
How two functions in the same class communicate with each other.
Aug 22nd, 2001 07:34
marc ap neb, Kopti Kumari,
A function in a class can call another function in the same class by
using the class function call ->. Calling to itself use this-> as
shown in the eg below.
Alternatively a class variable (variable scoping would be nice) can be
set up or variables can be passed by reference from one function to
another, again using this->someFunction(aParameter)
class Sample
{
function fOne()
{
$aVariable = $this->fTwo();
//$aVariable is set to the retuen value of fTwo and can then be
used for whatever.
}
function fTwo()
{
//do something
return someValue;
}
}