クラスに設定されていなくても、そのクラスの外部で新しい静的変数を宣言する方法はありますか?
// Using this class as a static object.
Class someclass {
// There is no definition for static variables.
}
// This can be initialized
Class classA {
public function __construct() {
// Some codes goes here
}
}
/* Declaration */
// Notice that there is no static declaration for $classA in someclass
$class = 'classA'
someclass::$$class = new $class();
どのようにそれを行うことができますか?
アドバイスありがとうございます。