Oh, something like this you mean:
class test
{
$thiscalled = false;
function testingthis()
{
$this->thiscalled = true;
return 'this';
}
function testingthat()
{
if($this->thiscalled)
{
return 'that';
}
// Two options:
// 1.) Call the first function yourself manually:
#$this->testingthis();
// 2.) Return false, and check for it in your other code
return false;
}
}
$test = new test;
// With option #1:
$something = $test->testingthat();
// With option #2:
if($test->testingthat() === false)
{
$test->testingthis();
}
It's essentially a modified singleton form. You only want to call it once. If $this->thiscalled is true, it's been called, otherwise, it hasn't.