Re: Array numeric key -> alpha key replacement

From: Date: Wed, 05 Dec 2007 19:32:30 +0000
Subject: Re: Array numeric key -> alpha key replacement
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-265479@lists.php.net to get a copy of this message
Jochem, Yes, that did the trick quite nicely. As I said, I overlooked it... a function called array_combine did not cause me to read the drill-down, because I figured it was for a union of two arrays ( it is, kind of... ) and I wanted to replace key values, not combine arrays : array_combine( (1,2,3,4), (5,6,7,8)) = array(1,2,3,4,5,6,7,8) which is what the name of the function implies is does, and which, for those of us who have read that portion of the manual knows, is accomplished by array_merge. Thanks for the help. Scot Quoting Jochem Maas <jochem@iamjochem.com>:
scotdiddle@silverdarkroom.com wrote:
Quoting Jochem Maas <jochem@iamjochem.com>:
...
$newArray = array('FAF1', 'ODM1', /* bla bla bla */); $inputArray = array_combine($newArray, $inputArray); I guess reading through this page was too much trouble for you:
    http://php.net/array
Jochem: Nope, not too much trouble... I tried to find what I was looking for on http://php.net/array. Sorry I was such a bother.
no bother, if everyone read the manual and found their answers there who would I vent my speel at? I'll assume that array_combine() does the trick for you.


« previous php.general (#265479) next »