I have parent class c1 with function hi(). class c2 extends c1 and contains singleton access through method i(). In class c2 I want to make method with the same name as in c1, which I can call in static scope, but in this method I whan to use singleton instance and call method with the same name from parent class.
class c1{
function hi(){
echo 'very '.$this->a;
}
}
class c2 extends c1{
private static $i;
public static function i() {
return (self::$i)?self::$i:(self::$i = new self);
}
public $a='cool';
function hi(){
self::i()->hi(); // here I want to call hi() from c1 but in instance scope
}
}
c2::hi(); //must echo: very cool
In real example
c1 is mysqli
c2 is my custom db class
and hi() is commit()
I want to be able to call db::commit(), so i dont need to write db::i()->commit();
EDIT: PHP < 5.3