I have read some posts on here but I can't quite find what I am looking for. I have an array of stdClass
Objects. Each element contains data for a field for a form. So you can imagine something like
Array ( [0] => stdClass Object ( [id] => 1 [title] => title ...
So now I am trying to create a form with fields in a certain order and am editing some code where the array variable already exists. Call it $fields
. I need to index into this array so for the field I am interested in, I can retrieve all the data. This amounts to being able to, for instance, achieve the following: get me the row of $fields
as $row
where the field title is title
so that I can then access the data as $row->$id
, etc.
I know this must be elementary, but my array skills are quite limited! Thanks!
edit: Ahhh, I just found this: PHP - find entry by object property from a array of objects That seems to be what I need.