foreach of key value converts array to object in laravel code example Example: php convert array to object $object = (object) $array;