I have the next array
Array (
[0] => Array ( [id] => 22 [title] => RankTitle )
[1] => Array ( [id] => 32 [title] => RankTitle2 )
)
How can I get the next array in php?:
Array (
[22] => RankTitle
[32] => RankTitle2
)
I have the next array
Array (
[0] => Array ( [id] => 22 [title] => RankTitle )
[1] => Array ( [id] => 32 [title] => RankTitle2 )
)
How can I get the next array in php?:
Array (
[22] => RankTitle
[32] => RankTitle2
)
You can do this:
$new = array();
foreach ($old as $item) {
$new[$item['id']] = $item['title'];
}
Do you mean this?
$array = Array (
[0] => Array ( [id] => 22 [title] => RankTitle )
[1] => Array ( [id] => 32 [title] => RankTitle2 )
)
$nextArray = array($array[0]['id'] => $array[0]['title'],
$array[1]['id'] => $array[1]['title']);