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

Breadcrumb

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

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\Part

Code

protected function compareStr($v1, $v2, $caseInsensitive, $matchStart, $matchEnd) {
    $regex = "#" . ($matchStart ? "^" : "") . preg_quote($v1) . ($matchEnd ? "\$" : "") . "#u" . ($caseInsensitive ? "i" : "");
    return (bool) preg_match($regex, $v2);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal