Hi! I'm pretty sure this can be done, but after 48 hours of trying, I'm asking for suggestions... but think it better to explain the process, so no one asks me 'why are you doing this?" :😁:
I EITHER NEED TO DO THIS, OR get a new approach from someone:
I have one array with 81 values, with keys 1 thru 81 and values of individual names
I have a second array with x values input by user (but never as many as 81, always less.) and KEYS are some of the VALUES of the first array.
Like this
from query of mySQL
$array1: (sort by value)
KEY VALUE
1 Bertha
2 Fred
3 David
4 Joshua
5 Mary
6 Matt
7 Nathaniel
etc, etc.
81 Zach
Array2: (number of values (in this case, 3) and value itself is derived from user input, key is derived from a loop.)
KEY VALUE
Fred 350
Mary 220
Zach 15
Obviously, the KEY of the smaller second array is the VALUE of the larger first array.
IS THIS AN APPROACH?
I'm thinking the first step is to flip($array1) - I think - so that the keys are now the values, and the values the keys. That I know how to do..
THIS, I DO NOT
Any way, once that's done, that I can DUMP the values in that new, flipped array, and leave the KEY with blank values, so I can MERGE the 2?
The end result should be ALL 81 KEYS, with blank values EXCEPT for the KEYS that had values in array2 --- i.e. the new array should look like this
KEY VALUE
Bertha
Fred 350
David
Joshua
Mary 220
Matt
Nathaniel
etc, etc.
Zach 15
Please be reassured if you're thinking "Why does she need those blank fields?" Trust me, I do, so any other approach suggestions will be useless... :😁:
I'd be grateful for help from some of you crafty and clever array manipulators out there.... :😄:
Thanks
Strat