Symfony\Polyfill\Mbstring

Mbstring::mb_substr_count │ public static │ CF7 1.0

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

Хуков нет.

Возвращает

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

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

$result = Mbstring::mb_substr_count( $haystack, $needle, $encoding );
$haystack(обязательный)
.
$needle(обязательный)
.
$encoding
.
По умолчанию: null

Код Mbstring::mb_substr_count() CF7 6.2.4.1

public static function mb_substr_count($haystack, $needle, $encoding = null)
{
    if ('' === $needle = (string) $needle) {
        if (80000 > \PHP_VERSION_ID) {
            trigger_error('mb_substr_count(): Empty substring', \E_USER_WARNING);

            return false;
        }

        throw new \ValueError('mb_substr_count(): Argument #2 ($needle) must not be empty');
    }

    if (!$search = self::prepareSearch((string) $haystack, $needle, self::getEncoding($encoding), false, true)) {
        return 0;
    }

    return substr_count($search[0], $search[1]);
}