[eluser]Andrewkha[/eluser]
Folks hi
Sorry for the not very self-explanatory topic title. Will try to explain here what I mean.
So when querying some table I usually get a result as 2 dimensional array:
Code:
Array
(
[0] => Array
(
[id] => 1
)
[1] => Array
(
[id] => 4
)
[2] => Array
(
[id] => 24
)
)
But to pass this further as a parameter to some function I need it to be look like single dimensional:
Code:
Array
(
[0] => 1
[1] => 4
[2] => 24
)
In order to make this happen I usually use the
foreach loop. But there's a feeling that there should be an easier way to do it. Any recommendations?
Code:
foreach($results as $result) {
$query_result[] = $result['id'];
}