How do I sort a 3-dimensional array that includes objects? How do I sort a 3-dimensional array that includes objects? wordpress wordpress

How do I sort a 3-dimensional array that includes objects?


It's because you are trying to access property of object in method of accessing array element. You cannot use the index to access the property of object. You should use -> instead of []. You can check this demo to issustrate how to access object property.

refer to how to access array/object

change your $a['data']['display_name'] to $a->data->display_name, and your $b in the compare funciton.