Skip to content

Instantly share code, notes, and snippets.

@brandonsavage
Created January 7, 2015 15:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandonsavage/801f921012d553b1a95d to your computer and use it in GitHub Desktop.
Save brandonsavage/801f921012d553b1a95d to your computer and use it in GitHub Desktop.
My favorite function in PHP...
public function configure(array $values = array())
{
foreach ($values as $key => $value) {
if (property_exists($this, $key)) {
$this->$key = $value;
}
}
return $this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment