private function Select::findParenMatch in Drupal driver for SQL Server and SQL Azure 8
Same name and namespace in other branches
- 3.0.x drivers/lib/Drupal/Driver/Database/sqlsrv/Select.php \Drupal\Driver\Database\sqlsrv\Select::findParenMatch()
Given a string find the matching parenthesis after the given point.
Parameters
string $string: The input string.
int $start_paren: The 0 indexed position of the open-paren, for which we would like to find the matching closing-paren.
Return value
int The 0 indexed position of the close paren.
1 call to Select::findParenMatch()
- Select::addExpression in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Select.php - Adds an expression to the list of "fields" to be SELECTed.
File
- drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Select.php, line 92 - Definition of Drupal\Driver\Database\sqlsrv\Select
Class
Namespace
Drupal\Driver\Database\sqlsrvCode
private function findParenMatch($string, $start_paren) {
$str_array = str_split(substr($string, $start_paren + 1));
$paren_num = 1;
foreach ($str_array as $i => $char) {
if ($char == '(') {
$paren_num++;
}
elseif ($char == ')') {
$paren_num--;
}
if ($paren_num == 0) {
return $i + $start_paren + 1;
}
}
}