search

Home  >  Q&A  >  body text

Can't this be used directly?

public function setName($name,$value){
$this->$name = $value;
}
Can’t we directly execute the following function to set the corresponding attributes? ?
$obj->setName('name','new name');
$obj->setName('age','22');
$obj->setName(' salary,'6000');
Why do you need to write setAge($name,$value) separately?

谁在乎昵称呢谁在乎昵称呢2433 days ago1261

reply all(0)I'll reply

No reply
  • Cancelreply