Automattic\WooCommerce\Vendor\Pelago\Emogrifier\Utilities
Preg::matchAll
Wraps preg_match_all.
If an error occurs, and exceptions are not being thrown, zero (0) is returned.
In the error case, if the $matches parameter is provided, it is set to an array containing empty arrays for the full pattern match and any possible subpattern match that might be expected. The algorithm to determine the length of this array simply counts the number of opening parentheses in the $pattern, which may result in a longer array than expected, but guarantees that it is at least as long as expected.
This method does not currently support the $flags or $offset parameters.
Метод класса: Preg{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$Preg = new Preg(); $Preg->matchAll( $pattern, $subject, ?array $matches ): int;
- $pattern(non-empty-string) (обязательный)
- .
- $subject(строка) (обязательный)
- .
- ?array $matches(передается по ссылке — &)
- .
По умолчанию: null
Код Preg::matchAll() Preg::matchAll WC 10.4.3
public function matchAll(string $pattern, string $subject, ?array &$matches = null): int
{
$result = \preg_match_all($pattern, $subject, $matches);
if ($result === false) {
$this->logOrThrowPregLastError();
$result = 0;
$matches = \array_fill(0, \substr_count($pattern, '(') + 1, []);
}
return $result;
}