Archives for July 2008

Recursive PHP in_array function

I needed a recursive in_array function the other day and disliked all the samples I found on php.net. I wrote this one using the StandardPHPLibrary. It will recursively search through a multidimensional array and return true if the $needle is found in the $haystack.

function in_array_recursive($needle, $haystack) {

    $it = new RecursiveIteratorIterator(new RecursiveArrayIterator($haystack));

    foreach($it [...]

Personal Life

I moved my personal life over to tumblr.adamgotterer.com. Feel free to follow my life by the minute. This site will now only be related to tech posts and my ventures.