我想知道它是否可能,如果是的话,我怎么会这样做:
$this->id < - 我有这样的事情.但为了让它更有用我想拥有$this->(and here to change the values)
对于前:我可能有 $this->id $this->allID $this->proj_id
我怎么能这样做,实际上我有$this->($myvariable here, that has a unique name in it)?
你可以简单地使用这个:
$variable = 'id';
if ( isset ( $this->{$variable} ) )
{
echo $this->{$variable};
}
Run Code Online (Sandbox Code Playgroud)