Sometimes you may prefer handling your data like an object instead of an array. I prefer object style when I am working with code handling json from API's etc..
So instead of the $my_array["field1"] notation you can handle it as $my_array->field1.
Its pretyy simple just cast your array variable like this:
$data = (object) $my_array;