Created
July 29, 2018 13:50
-
-
Save anver/36b3900eaa06af67711f38cd3699cada to your computer and use it in GitHub Desktop.
This file contains 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
The below code converted the outer most array to object and not the nested arrays. | |
$object = json_decode(json_encode($array), false); | |
but this will force all sub elements to objects | |
$object = json_decode(json_encode($array, JSON_FORCE_OBJECT), false); | |
I'm pretty sure the solution would be similar when converting from object to array. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment