php - Convert associative array to key=>value -


i have following array

array (     [0] => array         (             [id] => 5             [name] => 44         )      [1] => array         (             [id] => 9             [name] => 55         )  ) 

i need convert to

array( '5' => '44', '9' => '55' )  

i tried function of arrays php.net not figure out how it

did try foreach?

$result = array(); foreach($yourarray $entry) {   $result[$entry['id']] = $entry['name']; } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -