I would like to know if there is a built in php function for what I'm trying to do here. I'm pulling ids from a mysql db, and this is the result I'm getting.
print_r($result);
// output
Array
(
[0] => SubCategory Object
(
[id] => 1
)
[1] => SubCategory Object
(
[id] => 5
)
This is fine... pretty standard (using the Yii framework).
What I need to do is build an array of the ids. Should look like this
print_r($someArray);
// output
Array
(
[0] => 1
[1] => 5
[2] => 14
[3] => 2
So is there a function built in to do this? Or do I have to loop through it like this?
foreach ($result as $row) {
// append to new array here
}
Thanks in advance...