WPCF7_FormTag::get_first_match_option()publicCF7 1.0

Retrieves the value of the first option matches the given regular expression pattern.

Метод класса: WPCF7_FormTag{}

Хуков нет.

Возвращает

Массив|true|false. Option value as an array of matched strings. False if there is no option matches the pattern.

Использование

$WPCF7_FormTag = new WPCF7_FormTag();
$WPCF7_FormTag->get_first_match_option( $pattern );
$pattern(строка) (обязательный)
Regular expression pattern.

Код WPCF7_FormTag::get_first_match_option() CF7 5.6.4

public function get_first_match_option( $pattern ) {
	foreach( (array) $this->options as $option ) {
		if ( preg_match( $pattern, $option, $matches ) ) {
			return $matches;
		}
	}

	return false;
}