Tag: recursion
-
Recursively cast to array in PHP
I recently ran into an issue where JSON encoding some objects in my code wasn’t working properly. After experimenting, I realized that casting everything to an array before JSON encoding magically fixed things. Casting an object to an array is simple enough: But, what happens when an object or array contains references to other objects […]