Convert a PHP objec...
 
Notifications
Clear all

[Sticky] Convert a PHP object to an associative array


admin
Posts: 6
Admin
Topic starter
(@admin)
Member
Joined: 1 month ago

I'm integrating an API to my website which works with data stored in objects while my code is written using arrays.

I'd like a quick-and-dirty function to convert an object to an array.

Topic Tags
1 Reply
1 Reply
whitegrace628
(@whitegrace628)
Joined: 1 week ago

New Member
Posts: 2
Posted by: @admin

I'm integrating an API to my website which works with data stored in objects while my code is written using arrays.

I'd like a quick-and-dirty function to convert an object to an array.

$myArray = json_decode(json_encode($object), true);
Reply