Example #1
0
 static function between($str, $start, $end, &$endPos, $caseInsensitive = false)
 {
     if (!strlen($str) or !strlen($start) or !strlen($end)) {
         return false;
     }
     if (!is_array($start)) {
         $start = array($start);
     }
     if (!is_array($end)) {
         $end = array($end);
     }
     $pos1 = ra::strpos($str, $start, $found, $endPos, $caseInsensitive);
     if ($pos1 === false) {
         return false;
     }
     $pos1 += strlen($found);
     $pos2 = ra::strpos($str, $end, $found, $pos1, $caseInsensitive);
     if ($pos2 === false) {
         return false;
     }
     $endPos = $pos2;
     return substr($str, $pos1, $pos2 - $pos1);
 }