How to Use a method of a model in the same model Class

#1
[eluser]davidino86[/eluser]
Hi to everybody,


can i and how use a function (method) of a model class in anoter method of the same model?

ex:

Code:
class mymodel extends Model

function mymodel()
{
   parent::Model();
}

fucntion firtMethod()
{
   //Call the second method
   $this->secondMethod($realVar);
}

function secondMethod($var)
{
  fetch something;
  retutn result;

}

#2
[eluser]davidino86[/eluser]
i got!

i'm sorry, i need to put the echo before the function

like this:

Code:
echo this->secondMethod($realVar);

#3
[eluser]Phil Sturgeon[/eluser]
Yeah that works fine. Did you try before you posted?

#4
[eluser]davidino86[/eluser]
no i'm sorry.

i think that if i write return is not necessary to put echo


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.