Created
August 18, 2023 15:06
-
-
Save andyg1/eed651e27cd7484fd04aa4f0e02e1e8f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function objectToArray($object) { | |
$json = json_encode($object); | |
return json_decode($json, true); | |
} | |
// or, in one line | |
$nestedArray = json_decode(json_encode($object), true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment