You are here

public static function gapi::array_key_exists_nc in Google Analytics Statistics 7

Same name and namespace in other branches
  1. 7.x inc/gapi.class.php \gapi::array_key_exists_nc()

Case insensitive array_key_exists function, also returns matching key.

Parameters

String $key:

Array $search:

Return value

String Matching array key

3 calls to gapi::array_key_exists_nc()
gapi::__call in includes/gapi.class.php
Call method to find a matching root parameter or aggregate metric to return
gapiAccountEntry::__call in includes/gapi.class.php
Call method to find a matching parameter to return
gapiReportEntry::__call in includes/gapi.class.php
Call method to find a matching metric or dimension to return

File

includes/gapi.class.php, line 587

Class

gapi
GAPI - Google Analytics PHP Interface

Code

public static function array_key_exists_nc($key, $search) {
  if (array_key_exists($key, $search)) {
    return $key;
  }
  if (!(is_string($key) && is_array($search))) {
    return false;
  }
  $key = strtolower($key);
  foreach ($search as $k => $v) {
    if (strtolower($k) == $key) {
      return $k;
    }
  }
  return false;
}