Created
August 14, 2012 21:08
-
-
Save j2deme/3353063 to your computer and use it in GitHub Desktop.
"One line" PHP Array to Object
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
<?php | |
/** | |
* It's always nice to remeber that you can convert an array to an object just typecasting the variable. | |
* Clean and straight to the point :) | |
*/ | |
$obj = (object) $array; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment