Searching in a multi-dimensional array (PHP)
<p>I'm having a problem lately that's driving me crazy. I have a multi-dimensional array like this: </p>

<pre><code>$a = array(
'db' =&gt; array(
    '0' =&gt; array(
        'id' =&gt; '1',
        'name' =&gt; 'test',
        'cat' =&gt; array(
            'a' =&gt; '15',
            'b' =&gt; '20',
            'c' =&gt; '30'
        ),
        'canvas' =&gt; '2'
    ),
    '1' =&gt; array(
        'id' =&gt; '2',
        'name' =&gt; 'test2',
        'cat' =&gt; array(
            'a' =&gt; '15',
            'b' =&gt; '20',
            'c' =&gt; '30'
        ),
        'canvas' =&gt; '2'
    )
    '2' =&gt; array(
        'id' =&gt; '3',
        'name' =&gt; 'test',
        'cat' =&gt; array(
            'a' =&gt; '50',
            'b' =&gt; '40',
            'c' =&gt; '90'
        ),
        'canvas' =&gt; '1'
    )
)
);
</code></pre>

<p>And i want to search on it using a function like this: search('canvas = 1'); </p>

<p>That would return all the arrays, child of db, that have a key canvas with the value of 1. Or, for example: </p>

<p>search('a = 15');</p>

<p>Would return all arrays that have a key, child of cat, named a and with a value of 15. </p>
