![]() |
Efficient way to match unordered arrays?
I have a function which I am entering an array, and the job of the function is to match the entered array to an array within the list. It looks a little something like this...
PHP Code:
If there are no matches, OR if 'arry' contains a match but has extra items which are not in the list (i.e {"Test One", "Test Two", "Test Three"}) it should return false. I could probably do some magic and come up with a way to match these, but I'd like to see some of your ideas to match them as there is probably a much better way then what I would do. Thanks :) |
PHP Code:
|
HTML Code:
function onCreateds() { |
Stupid of me to post this and then come up with a solution for myself 10 minutes later.
Modifying your script to how for what I wanted worked perfectly. So thanks for the help. I also came up with this script awhile after I made the thread... PHP Code:
|
I think either of your two ways would be better to use since they're skipping cycles which are unnecessary instead of running through them and comparing the sizes afterwards.
|
An array is pretty much just a string with comma's in it, so as long as you aren't doing crazy stuff this should get you by.
PHP Code:
|
| All times are GMT +2. The time now is 10:17 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.