public function search($field, $value, $strict = false)
    {
        $value = is_array($value) ? $value : array($value);
        foreach ($this as $key => $entity) {
            if (isset($entity->$field) && in_array($entity->$field, $value, $strict)) {
                return $key;
            }
        }

        return false;
    }
public function search($field, $value, $strict = false)
    {
        $value = is_array($value) ? $value : array($value);
        foreach ($this as $key => $entity) {
            if (isset($entity->$field) && in_array($entity->$field, $value, $strict)) {
                return $key;
            }
        }

        return false;
    }
public function search ( $ field , $ value , $ strict = false ) { $ value = is_array ( $ value ) ? $ value : array ( $ value ) ; foreach ( $ this as $ key => $ entity ) { if ( isset ( $ entity -> $ field ) && in_array ( $ entity -> $ field , $ value , $ strict ) ) { return $ key ; } } return false ; }
Search for an element with given property and value

@param string $field name of property
@param mixed $value value to compare
@param bool $strict compare value and type of property

@return integer|string|false
Search for an element with given property and value