search all keys of an associative array (containing key => value, instead of [0],[1],[2]) for a substring, return value associated with that key/property.

/* returns the $value of the element,
* if $search_for_this_string is found in one of the keys of $element
* otherwise returns null
* */
function ArraySearchForStringInAllKeys($this_string,$array_assoc)
{
  $looking_for_that_value = null;
  foreach ($array_assoc as $key => $value)
  {
    if(stripos($key, $this_string) !== false) // check if $key contains $this_string
    {
      $looking_for_that_value = $value;
      break;
    }
  }

  return $looking_for_that_value;
}
admin