How to convert an array to object in PHP?

Warning message

JQuery Cycle must be installed in order to run the slideshow. Please go to Status Report for instructions.
// *convert array to object* 
// Array([id]=> 123 [username]=>techrappers)
$object = (object) $array_name;

//now it is converted to object and you can access it.
echo $object->username;