本文整理匯總了PHP中SqlFormatter::regex_function方法的典型用法代碼示例。如果您正苦於以下問題:PHP SqlFormatter::regex_function方法的具體用法?PHP SqlFormatter::regex_function怎麽用?PHP SqlFormatter::regex_function使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SqlFormatter
的用法示例。
在下文中一共展示了SqlFormatter::regex_function方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: init
/**
* Stuff that only needs to be done once. Builds regular expressions and sorts the reserved words.
*/
protected static function init()
{
if (self::$init) {
return;
}
// Sort reserved word list from longest word to shortest, 3x faster than usort
$reservedMap = array_combine(self::$reserved, array_map('strlen', self::$reserved));
arsort($reservedMap);
self::$reserved = array_keys($reservedMap);
// Set up regular expressions
self::$regex_boundaries = '(' . implode('|', array_map(array(__CLASS__, 'quote_regex'), self::$boundaries)) . ')';
self::$regex_reserved = '(' . implode('|', array_map(array(__CLASS__, 'quote_regex'), self::$reserved)) . ')';
self::$regex_reserved_toplevel = str_replace(' ', '\\s+', '(' . implode('|', array_map(array(__CLASS__, 'quote_regex'), self::$reserved_toplevel)) . ')');
self::$regex_reserved_newline = str_replace(' ', '\\s+', '(' . implode('|', array_map(array(__CLASS__, 'quote_regex'), self::$reserved_newline)) . ')');
self::$regex_function = '(' . implode('|', array_map(array(__CLASS__, 'quote_regex'), self::$functions)) . ')';
self::$init = true;
}
示例2: init
/**
* Stuff that only needs to be done once. Builds regular expressions and sorts the reserved words.
*/
protected static function init()
{
if (self::$init) {
return;
}
// Sort reserved word list from longest word to shortest
usort(self::$reserved, array('SqlFormatter', 'sortLength'));
// Set up regular expressions
self::$regex_boundaries = '(' . implode('|', array_map(array('SqlFormatter', 'quote_regex'), self::$boundaries)) . ')';
self::$regex_reserved = '(' . implode('|', array_map(array('SqlFormatter', 'quote_regex'), self::$reserved)) . ')';
self::$regex_reserved_toplevel = str_replace(' ', '\\s+', '(' . implode('|', array_map(array('SqlFormatter', 'quote_regex'), self::$reserved_toplevel)) . ')');
self::$regex_reserved_newline = str_replace(' ', '\\s+', '(' . implode('|', array_map(array('SqlFormatter', 'quote_regex'), self::$reserved_newline)) . ')');
self::$regex_function = '(' . implode('|', array_map(array('SqlFormatter', 'quote_regex'), self::$functions)) . ')';
self::$init = true;
}