Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Preg.php

function Preg::replaceCallbackArray

@param-out int<0, max> $count

Parameters

($flags is PREG_OFFSET_CAPTURE ? (array<string, callable(array<int|string, array{string|null, int<-1, max>}>): string>) : array<string, callable(array<int|string, string|null>): string>) $pattern:

string $subject:

int $count Set by method:

int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_OFFSET_CAPTURE is supported, PREG_UNMATCHED_AS_NULL is always set:

1 call to Preg::replaceCallbackArray()
Regex::replaceCallbackArray in vendor/composer/pcre/src/Regex.php

File

vendor/composer/pcre/src/Preg.php, line 221

Class

Preg

Namespace

Composer\Pcre

Code

public static function replaceCallbackArray(array $pattern, $subject, int $limit = -1, ?int &$count = null, int $flags = 0) : string {
    if (!is_scalar($subject)) {
        if (is_array($subject)) {
            throw new \InvalidArgumentException(static::ARRAY_MSG);
        }
        throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
    }
    $result = preg_replace_callback_array($pattern, $subject, $limit, $count, $flags | PREG_UNMATCHED_AS_NULL);
    if ($result === null) {
        $pattern = array_keys($pattern);
        throw PcreException::fromFunction('preg_replace_callback_array', $pattern);
    }
    return $result;
}
RSS feed
Powered by Drupal