当前位置: 首页>>代码示例>>PHP>>正文


PHP FSS_Helper::stringStartsWith方法代码示例

本文整理汇总了PHP中FSS_Helper::stringStartsWith方法的典型用法代码示例。如果您正苦于以下问题:PHP FSS_Helper::stringStartsWith方法的具体用法?PHP FSS_Helper::stringStartsWith怎么用?PHP FSS_Helper::stringStartsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FSS_Helper的用法示例。


在下文中一共展示了FSS_Helper::stringStartsWith方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Match

 function Match($line, $lines, $offset)
 {
     $line = trim($line);
     if ($line == "") {
         return false;
     }
     $match = false;
     // check for any starts with
     if (count($this->starts) > 0) {
         foreach ($this->starts as $starts) {
             if (FSS_Helper::stringStartsWith($line, $starts)) {
                 $match = true;
             }
         }
     }
     // check for any regular expressions
     if (count($this->regex) > 0) {
         foreach ($this->regex as $regex) {
             if (preg_match("/" . $regex . "/i", $line)) {
                 $match = true;
             }
         }
     }
     // no match found, so done
     if (!$match) {
         return false;
     }
     // have a match, if there are any nearby clauses, check them all
     if (count($this->nearby) > 0) {
         foreach ($this->nearby as $nearby) {
             // setup default lines before and after
             if (empty($nearby->lines)) {
                 $nearby->lines = 3;
             }
             if (empty($nearby->before)) {
                 $nearby->before = $nearby->lines;
             }
             if (empty($nearby->after)) {
                 $nearby->after = $nearby->lines;
             }
             // if there is a regex in the nearby, check it
             if (isset($nearby->regex)) {
                 // create new match class
                 $test = new TrimMatch();
                 $test->regex[] = $nearby->regex;
                 // work out which lines
                 $start = max(0, $offset - $nearby->before);
                 $end = min(count($lines) - 1, $offset + $nearby->after);
                 $found = false;
                 // check each line
                 for ($i = $start; $i <= $end; $i++) {
                     $subline = trim($lines[$i]);
                     if ($test->Match($subline, $lines, $i)) {
                         $found = true;
                         break;
                     }
                 }
                 // if its not found, we failed for this line
                 if (!$found) {
                     return false;
                 }
             }
         }
     }
     return true;
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:66,代码来源:emailcheck.php


注:本文中的FSS_Helper::stringStartsWith方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。