function Attribute::compareStr
Compares two strings
Parameters
string $v1 Search value:
string $v2 Compare value:
bool $caseInsensitive True if the search must be case insensitive:
bool $matchStart True if the search must be executed from the: beginning of the string
bool $matchEnd True if the search must be executed from the: end of the string
Return value
bool
1 call to Attribute::compareStr()
- Attribute::check in vendor/
mck89/ peast/ lib/ Peast/ Selector/ Node/ Part/ Attribute.php - Returns true if the selector part matches the given node, false otherwise
File
-
vendor/
mck89/ peast/ lib/ Peast/ Selector/ Node/ Part/ Attribute.php, line 218
Class
- Attribute
- Selector part attribute class
Namespace
Peast\Selector\Node\PartCode
protected function compareStr($v1, $v2, $caseInsensitive, $matchStart, $matchEnd) {
$regex = "#" . ($matchStart ? "^" : "") . preg_quote($v1) . ($matchEnd ? "\$" : "") . "#u" . ($caseInsensitive ? "i" : "");
return (bool) preg_match($regex, $v2);
}