Return to Snippet

Revision: 37755
at December 16, 2010 23:47 by dyteq

Initial Code
$array = array( 'one' => 1, 'two' => 2);
$obj = json_decode(json_encode($array));

Initial URL

Initial Description
This method is easy to write, but not very efficient, as you can imagine.

Initial Title
Convert associative array to object (class) in a single line

Initial Tags
php, object, array, line, convert

Initial Language