_wp_can_use_pcre_u()WP 4.2.2

Returns whether PCRE/u (PCRE_UTF8 modifier) is available for use.

Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.

Хуков нет.

Возвращает

null. Ничего (null).

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

_wp_can_use_pcre_u( $set );
$set(true|false)
- Used for testing only null : default - get PCRE/u capability false : Used for testing - return false for future calls to this function 'reset': Used for testing - restore default behavior of this function
По умолчанию: null

Список изменений

С версии 4.2.2 Введена.

Код _wp_can_use_pcre_u() WP 6.5.2

function _wp_can_use_pcre_u( $set = null ) {
	static $utf8_pcre = 'reset';

	if ( null !== $set ) {
		$utf8_pcre = $set;
	}

	if ( 'reset' === $utf8_pcre ) {
		// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- intentional error generated to detect PCRE/u support.
		$utf8_pcre = @preg_match( '/^./u', 'a' );
	}

	return $utf8_pcre;
}