Reputation: 507
can we call a static function in other static function in a class if yes please help me.I am using this php code.
static function getconfig()
{
$db = JFactory::getDBO();
$query='select * from #__yellowpages_config';
$db->setQuery($query);
$result=$db->loadObject();
$config->city=JRequest::getVar('city',0);
$config->country=JRequest::getVar('c',0);
if($config->city==0)
$config->city=$result->city;
if($config->country==0)
$config->country=$result->country;
return $config;
}
static function getitem()
{
//how I call the getconfig function here.
}
Upvotes: 0
Views: 72
Reputation: 29424
Use self::method()
if you want to refer to the same class.
Use static::method()
if you want to refer to whatever class in hierarchy which you call the method on.
See also this question: New self vs. new static
Upvotes: 2