and like us on FB

If you need to quickly and easily convert an object to an associative array, the following is a simple solution:

In many cases – and if the above doesn’t float your boat – you may simply typecast it:

However, neither of the above solutions work with objects that contain protected and/or private values. In our case, we were trying to access protected header values from WP’s wp_remote_get function. The following function will return an associative array with values accessible via traditional means.

Shortt URL for this post: