Skip to content

Instantly share code, notes, and snippets.

@JamieKnight
Created May 18, 2011 19:43
Show Gist options
  • Save JamieKnight/979376 to your computer and use it in GitHub Desktop.
Save JamieKnight/979376 to your computer and use it in GitHub Desktop.
A simple method to update properties from array returned buy $query->result()
function updateFromArray($array){
foreach($array as $property => $value){
if(property_exists( $this, $property)){
$this->$property = $value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment