note 43527 added to function.array-combine

From: Date: Thu, 24 Jun 2004 14:40:43 +0000
Subject: note 43527 added to function.array-combine
Groups: php.notes 
Request: Send a blank email to php-notes+get-71592@lists.php.net to get a copy of this message
This function is the PHP4 replacement PHP function for array_combine (PHP5). function assoc_key_val($a_keys,$a_values) { if(!is_array($a_keys)) $a_keys = array(); if(!is_array($a_values)) $a_values = array(); $keys = array_merge($a_keys); $vals = array_values($a_values); $ret = array(); foreach($keys as $key) { list($unused,$val) = each($vals); $ret[$key] = $val; } return $ret; } It could be usefull for someone who wants to make an array_intersect() on an associative array. Romain FABBRI (FRANCE) ---- Manual Page -- http://www.php.net/manual/en/function.array-combine.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43527 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43527&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43527&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#71592) next »