[eluser]keld[/eluser]
Hi,
I have 2 functions inside one of my model and I want the first one to call the other one to generate part of the result like this:
Code:
function a($id)
{
$myarray=array();
$Q=$this->db->query(...);
//foreach loop and assign values to the array
$myarray["stuff"]=b($id);
return $myarray; //send to controller
}
function b($id){
$myarray2=array();
//do things (like another query)
return $myarray2;
}
So if I do this, i get a php error sayinf that function b() doesn't exist.
Now if I inside function a() i add self:: like so:
Code:
$myarray["stuff"]=self::b($id);
It's working. I just thought self:: was for use in classes, is there a reason for why function b wouldn't be recognized without self?
Thanks.