Skip to content

Instantly share code, notes, and snippets.

@joshtronic
Created September 26, 2010 20:17
Show Gist options
  • Save joshtronic/598285 to your computer and use it in GitHub Desktop.
Save joshtronic/598285 to your computer and use it in GitHub Desktop.
Magic Setter Example
public function __set($name, $value)
{
if (isset($this->$name))
{
trigger_error('Cannot set variable after declaration', E_USER_ERROR);
return false;
}
else
{
$this->$name = $value;
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment