I’m writing a script in PHP that compares people together based on the number of same answers in a survey. I use an array like this:
[person ID]=>number of answers same
to store the 10 people closest to the one I am comparing with.
I need to figure out how to find the lowest of the 10 number of answers same and overwrite a higher number of answers same and modify the person ID key with it.
Wouldn’t it just be easier to keep your array sorted by number of same answers? Maybe even just add the new person, resort the array and remove the first/last..