Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 3
    Because you have arrays of objects, you'll either need to walk through them doing this "manually", or convert them to arrays of arrays first Commented Feb 28, 2017 at 8:16
  • @MarkBaker, can you show me how to do that, I've no idea how to convert them into array? Commented Feb 28, 2017 at 8:18
  • 1
    array_walk($myArray, function(&$value) { $value = (array) $value; }); Commented Feb 28, 2017 at 8:22
  • array_walk() is "pass by reference; the returned value is boolean success/ failure, so don't assign that to your arrays, else you're overwriting the array Commented Feb 28, 2017 at 10:02