Welcome Guest, Not a member yet? Register   Sign In
passing a variable back to a function
#1

[eluser]Unknown[/eluser]
Hello,

my question is, if I have a function called test1() and this function is called in my controller:

Code:
$this->test1();

but I also wish a function called test2 to pass a variable to it later in the code.

Code:
public function test2(){
   $passed='foo';
   return $passed;
}

$this->test1($passed);

My program throws an error because $passed is not needed the first time. Do I need to override test with another implementation. How would I do this.

Sorry if this is a basic question. Any help or advice would be greatly appreciated.

Thanks

PTVW


Messages In This Thread
passing a variable back to a function - by El Forum - 12-21-2010, 12:47 PM
passing a variable back to a function - by El Forum - 12-21-2010, 01:40 PM
passing a variable back to a function - by El Forum - 12-22-2010, 01:26 PM
passing a variable back to a function - by El Forum - 12-22-2010, 03:53 PM
passing a variable back to a function - by El Forum - 12-22-2010, 03:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB