Posted By

iloveitaly on 07/07/09


Tagged

php array create keys values


Versions (?)

array_from_keys_values


 / Published in: PHP
 

  1. function array_from_keys_values($keys, $values) {
  2. $ar = array();
  3.  
  4. $keys = array_values($keys);
  5. $values = array_values($values);
  6.  
  7. foreach($keys as $index => $key) {
  8. $value = $values[$index];
  9. $ar[$key] = $value;
  10. }
  11.  
  12. return $ar;
  13. }

Report this snippet  

You need to login to post a comment.