I could find the answer here, even though the question wasn't phrased in the same way: PHP 5.3: Late static binding doesn't work for properties when defined in parent class while missing in child class
In my little example, the problem comes from the fact that apparently, unless specified otherwise (see below how), the storage for static variables is the same for a "family" of classes (that is, for mother and all children classes). To make sure each class gets its own storage, you just need to redeclare the same static variables in the child class, like so:
/**
* Children using inherited static method
*/
class C1 extends A
{
public static $_greetings;
public function say() { self::hi(); }
}
class C2 extends A
{
public static $_greetings;
public function say() { self::hi(); }
}
Putting this back into the previous example, the output is exactly as expected:
Setting C1::_greetings to Hello World!
Setting C2::_greetings to Ola Chica!
C1 says Hello World!
C2 says Ola Chica!
Hello World!
Ola Chica!