convert an array to object in php by defining keys code example Example: php convert array to object $object = (object) $array;