谁能解释这种行为?
$object = new stdClass();
//This works.
$object->test = "Test";
//This works.
$arbitrary = "arbitrary";
$object->$$arbitrary = "again, testing";
//This works.
$object->id = "2";
//This fails
$test = "id";
$object->$$test = "2"; // On this line.
我正在尝试通过动态变量名称设置“id”属性。如果我明确说明,我可以很好地设置“id”属性。我可以动态设置其他变量名——即“任意”。有什么建议么?