In an array such as the one below, how could I rename "fee_id" to "id"?
Array (     [0] => Array         (             [fee_id] => 15             [fee_amount] => 308.5             [year] => 2009                         )      [1] => Array         (             [fee_id] => 14             [fee_amount] => 308.5             [year] => 2009          )  ) 
                $new = "new_name"; $array[$new]=$array["Order_no"]; unset($array["Order_no"]); print_r($array);
Description ¶ array_replace() replaces the values of array with values having the same keys in each of the following arrays. If a key from the first array exists in the second array, its value will be replaced by the value from the second array.
foreach ( $array as $k=>$v ) {   $array[$k] ['id'] = $array[$k] ['fee_id'];   unset($array[$k]['fee_id']); }   This should work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With