Created
May 18, 2011 19:43
-
-
Save JamieKnight/979376 to your computer and use it in GitHub Desktop.
A simple method to update properties from array returned buy $query->result()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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