Wednesday, 21 August 2013

How do I convert any string, number, or object into an array?

How do I convert any string, number, or object into an array?

Say, for instance, I load something with simplexml_load_file() but I want
the output to be an array instead of an object.
Or, say I have a dynamic value that will sometimes be a string, other
times an array, and other times an object (ie I don't know what the input
will be, but I want the output to always be an array, no matter what).
What's the best way to ensure any value I have is given back to me as an
array?

No comments:

Post a Comment