You are so close to what I mean..
Ok, let me clarify.
My function, previously removes elements from arrays and leaves a specific element back on that array. It doesn't change the keys, it simply unsets the ones I don't want.
For example, if a there is an array like this:
0=>"blah"
1=>"saa"
2=>"wee"
When I use my function:
myfilter($array,"saa")
It unsets 0,2
And leaves 1.
So that resultant array is now
$array =array(1=>"saa");
You can find that out if you test my code out.
But there is a problem, I said up there that the "resultant array" and not the "original array"
So what the function has done, is basically took the $array and made another array which is the result.
So it hasn't actually changed the "original array" but the made a new array "result" which is the one I want.
Of course this is easily solved.
We simply just used $result. Or we can overwrite $original array = $result array.
This is only for a single dimensional array.
BUT!
What happens when it's a multidimensional array?
Well basically the same thing happens. Except for one thing.
When it unsets the array, It doesn't unset the whole array, only where the element resides in.
So if "saa" was in $array[0][0]. Then it only unsets the elements in $array[0]. All the other elements in $array are fine.
Understand?
So everything works, until we get to the overwriting process. The "myfilter" function still makes a resultant array. This array however isn't the whole original array, it makes the array of where the excepted element resides in.
So we need to do a overwriting process again.
But here's the problem.
I know where the element is. This is because I have another function that finds the keys that I need. So I have an $index which is an array of the keys. In normal number format of course.
So say we try to overwrite a 2dimensional array. Example: $ar2
$ar2 is an array
$ar2[0] is an array
$ar2[1] is an array
$ar2[1][0] is "saa"
So we do the function, it removes all of $ar2[1] but leaves $ar[1][0] which is "saa"
$ar[0] is however fine.
So the function produces a result.
$result is an array of results, only one result exists.
$result[1] is the array of the thing we want.
So to overwrite we do
$ar2[1] = $result[1]
Remember that $ar2[1] is an array of the where the element resides in. And $result[1] simply copied it and threw away the ones we didn't want.
And for third dimension arrays.
$ar3[$number1][$number2] = $result[$number1][$number2]
Where the numbers are the keys.
$number1 will be the array of the selected array. $number2 will be the array of the selected element.
So on, so you can see my problem.
I know the numbers. But I don't know the size of the array. How am I going to overwrite it? Other than using eval of course.
Array flow? What is that, I have never seen it before.