Welcome Guest, Not a member yet? Register   Sign In
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




Theme © iAndrew 2016 - Forum software by © MyBB