Revision: 17304
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 31, 2009 13:08 by canarymason
Initial Code
/**
* Takes a needle and haystack (just like in_array()) and does a wildcard search on it's values.
*
* @param string $string Needle to find
* @param array $array Haystack to look through
* @result array Returns the elements that the $string was found in
*/
function wildcard_in_array ($string, $array = array ())
{
foreach ($array as $key => $value) {
unset ($array[$key]);
if (strpos($value, $string) !== false) {
$array[$key] = $value;
}
}
return $array;
}
Initial URL
Initial Description
Initial Title
find needle w/ wildcard in an array
Initial Tags
Initial Language
PHP