Re: [PHP] Array numeric key - alpha key replacement
[EMAIL PROTECTED] wrote: Hello All, Is the a built-in PHP call that I am overlooking which lets me replace key values in an array. $inputArray = array(0 = array, 1 = array); (generated programtically) I want to end up with : $newArray = array('FAF1' = array, 'ODM1' = array); Thanks. $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 Scot L. Diddle, UPS Freight, Richmond VA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array numeric key - alpha key replacement
[EMAIL PROTECTED] wrote: Quoting Jochem Maas [EMAIL PROTECTED]: ... $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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array numeric key - alpha key replacement
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 [EMAIL PROTECTED]: [EMAIL PROTECTED] wrote: Quoting Jochem Maas [EMAIL PROTECTED]: ... $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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array numeric key - alpha key replacement
[EMAIL PROTECTED] wrote: 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. granted the names are less than perfect, you do illustrate very well that assumptions (of any kind) pretty much suck (at least when it comes to this kind of work) ... I assume you understand what I mean ;-) I do recommend a thorough read of all the major sections of the docs (those covering core functionality more than anything). garanteed you'll come accross stuff that you'll use 3 months down the line which you would otherwise have to search deity knows how long for ... at least that's my experience. Thanks for the help. please come back soon. my spleen needs the exercise. ;-) Scot Quoting Jochem Maas [EMAIL PROTECTED]: [EMAIL PROTECTED] wrote: Quoting Jochem Maas [EMAIL PROTECTED]: ... $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? spleen. doh. I'll assume that array_combine() does the trick for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array numeric key - alpha key replacement
Hello All, Is the a built-in PHP call that I am overlooking which lets me replace key values in an array. $inputArray = array(0 = array, 1 = array); (generated programtically) I want to end up with : $newArray = array('FAF1' = array, 'ODM1' = array); Thanks. Scot L. Diddle, UPS Freight, Richmond VA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array numeric key - alpha key replacement
- Original Message - From: [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Wednesday, December 05, 2007 1:00 PM Subject: [PHP] Array numeric key - alpha key replacement Hello All, Is the a built-in PHP call that I am overlooking which lets me replace key values in an array. $inputArray = array(0 = array, 1 = array); (generated programtically) I want to end up with : $newArray = array('FAF1' = array, 'ODM1' = array); Thanks. Scot L. Diddle, UPS Freight, Richmond VA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php What about: $inputArray = array(); $inputArray['FAF1'] = array(); $inputArray['ODM1'] = array(); print_r($inputArray); HTH, Cor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array numeric key - alpha key replacement
Quoting Jochem Maas [EMAIL PROTECTED]: [EMAIL PROTECTED] wrote: Hello All, Is the a built-in PHP call that I am overlooking which lets me replace key values in an array. $inputArray = array(0 = array, 1 = array); (generated programtically) I want to end up with : $newArray = array('FAF1' = array, 'ODM1' = array); Thanks. $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. Scot Scot L. Diddle, UPS Freight, Richmond VA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php