Automattic\WooCommerce\Vendor\Pelago\Emogrifier\Utilities

Preg::replacepublicWC 1.0

Wraps preg_replace, though does not support $subject being an array. If an error occurs, and exceptions are not being thrown, the original $subject is returned.

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

Хуков нет.

Возвращает

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

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

$Preg = new Preg();
$Preg->replace( $pattern, $replacement, $subject, $limit, ?int $count ): string;
$pattern(non-empty-string|non-empty-array) (обязательный)
.
$replacement(строка|non-empty-array) (обязательный)
.
$subject(строка) (обязательный)
.
$limit(int)
.
По умолчанию: -1
?int $count(передается по ссылке — &)
.
По умолчанию: null

Код Preg::replace() WC 10.4.3

public function replace($pattern, $replacement, string $subject, int $limit = -1, ?int &$count = null): string
{
    $result = \preg_replace($pattern, $replacement, $subject, $limit, $count);

    if ($result === null) {
        $this->logOrThrowPregLastError();
        $result = $subject;
    }

    return $result;
}