I have an array like this $items():
Array
(
[0] => Array
(
[id] => 1
[first_name] => fname1
[laste_name] => lname1
[Age] => 20
)
[1] => Array
(
[id] => 2
[first_name] => fname2
[laste_name] => lname2
[Age] => 22
)
)
And I want to create another array only with [id] and [Age]
Array
(
[0] => Array
(
[id] => 1
[Age] => 20
)
[1] => Array
(
[id] => 2
[Age] => 22
)
)
So I have tried looping like this :
$array = array();
foreach($items as $item) {
$array['id']= $item['id'];
$array['age']= $item['age'];
}
But It gives only values of the last item