The thing is, suppose we have three classes A, B and C. B and C inherit from A.
<?php
class A{
public static function update(){
static::$id = 1;
}
}
class B extends A{
public static $id_B;
}
class C extends A{
public static $id_C;
}
A::update();
?>
Because of any reasons, the id's name in B and C are different. The B is id_B, and C is id_C. The class A is kind of interface so it just know the inherited class B and C should have a variable $id. A wants to update $id to 1. What I want is try to update $id_B and $id_C to 1. I tried several methods like set a variable variables like this:
class A{
public static function update(){
static::$$id_name = 1;
}
}
class B extends A{
public static $id_name="id_B";
public static $id_B;
}
But it doesn't work. So does anyone can help me solve this design?