PHP find array key recursively

Today I had an issue where I needed to find a key in multidimensional array. It took trial and error ant some googling around, but this is what I found. <php function recursiveFind(array $haystack, $needle) { $iterator = new RecursiveArrayIterator($haystack); $recursive = new RecursiveIteratorIterator( $iterator, RecursiveIteratorIterator::SELF_FIRST ); foreach ($recursive…