function StrPos($haystack, $needle, $offset = 0)
 {
     $comp = 0;
     while (!isset($length) || $length < $offset) {
         $pos = strpos($haystack, $needle, $offset + $comp);
         if ($pos === false) {
             return false;
         }
         $length = CConvertUtf8::strlen(substr($haystack, 0, $pos));
         if ($length < $offset) {
             $comp = $pos - $length;
         }
     }
     return $length;
 }
Exemple #2
0
 function StrPos($haystack, $needle, $offset = 0)
 {
     $length = null;
     $comp = 0;
     while (null === $length || $length < $offset) {
         $pos = strpos($haystack, $needle, $offset + $comp);
         if (false === $pos) {
             return false;
         }
         $length = CConvertUtf8::StrLen(substr($haystack, 0, $pos));
         if ($length < $offset) {
             $comp = $pos - $length;
         }
     }
     return $length;
 }