src/anekdotes/Arr.php
public static function getWhere($array, $key, $search, $default = null)
  {
      foreach ($array as $item) {
          if (isset($item[$key]) && $item[$key] == $search) {
              return $item;
          }
      }

      return $default;
  }
public static function getWhere($array, $key, $search, $default = null)
  {
      foreach ($array as $item) {
          if (isset($item[$key]) && $item[$key] == $search) {
              return $item;
          }
      }

      return $default;
  }
public static function getWhere ( $ array , $ key , $ search , $ default = null ) { foreach ( $ array as $ item ) { if ( isset ( $ item [ $ key ] ) && $ item [ $ key ] == $ search ) { return $ item ; } } return $ default ; }
Get an object in the array where its key is the same as the search value.

@param   array   $array    Array to search in
@param   string  $key      Key we're searching on
@param   mixed   $search   Value we're searching in the object
@param   mixed   $default  Default value in case no boject has the matching value for its key

@return  mixed             Found object
Get an object in the array where its key is the same as the search value .