當前位置: 首頁>>代碼示例>>PHP>>正文


PHP mb_strripos函數代碼示例

本文整理匯總了PHP中mb_strripos函數的典型用法代碼示例。如果您正苦於以下問題:PHP mb_strripos函數的具體用法?PHP mb_strripos怎麽用?PHP mb_strripos使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了mb_strripos函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testmb_strpos

 /**
  * @covers Patchwork\PHP\Override\Mbstring::mb_strpos
  * @covers Patchwork\PHP\Override\Mbstring::mb_stripos
  * @covers Patchwork\PHP\Override\Mbstring::mb_strrpos
  * @covers Patchwork\PHP\Override\Mbstring::mb_strripos
  */
 function testmb_strpos()
 {
     $this->assertSame(false, @mb_strpos('abc', ''));
     $this->assertSame(false, @mb_strpos('abc', 'a', -1));
     $this->assertSame(false, mb_strpos('abc', 'd'));
     $this->assertSame(false, mb_strpos('abc', 'a', 3));
     $this->assertSame(1, mb_strpos('한국어', '국'));
     $this->assertSame(3, mb_stripos('DÉJÀ', 'à'));
     $this->assertSame(false, mb_strrpos('한국어', ''));
     $this->assertSame(1, mb_strrpos('한국어', '국'));
     $this->assertSame(3, mb_strripos('DÉJÀ', 'à'));
     $this->assertSame(1, mb_stripos('aςσb', 'ΣΣ'));
     $this->assertSame(1, mb_strripos('aςσb', 'ΣΣ'));
     $this->assertSame(false, @p::mb_strpos('abc', ''));
     $this->assertSame(false, @p::mb_strpos('abc', 'a', -1));
     $this->assertSame(false, p::mb_strpos('abc', 'd'));
     $this->assertSame(false, p::mb_strpos('abc', 'a', 3));
     $this->assertSame(1, p::mb_strpos('한국어', '국'));
     $this->assertSame(3, p::mb_stripos('DÉJÀ', 'à'));
     $this->assertSame(false, p::mb_strrpos('한국어', ''));
     $this->assertSame(1, p::mb_strrpos('한국어', '국'));
     $this->assertSame(3, p::mb_strripos('DÉJÀ', 'à'));
     $this->assertSame(1, p::mb_stripos('aςσb', 'ΣΣ'));
     $this->assertSame(1, p::mb_strripos('aςσb', 'ΣΣ'));
 }
開發者ID:nicolas-grekas,項目名稱:Patchwork-sandbox,代碼行數:31,代碼來源:MbstringTest.php

示例2: validateEquals

 protected function validateEquals($input)
 {
     if (is_array($input)) {
         return end($input) == $this->endValue;
     }
     return mb_strripos($input, $this->endValue, -1, $enc = mb_detect_encoding($input)) === mb_strlen($input, $enc) - mb_strlen($this->endValue, $enc);
 }
開發者ID:dez-php,項目名稱:Validation,代碼行數:7,代碼來源:EndsWith.php

示例3: execute

 /**
  * LastIndexOf
  */
 public function execute()
 {
     if ($this->isCaseInsensitive()) {
         return mb_strripos($this->getValue(), $this->needle, $this->fromIndex);
     } else {
         return mb_strrpos($this->getValue(), $this->needle, $this->fromIndex);
     }
 }
開發者ID:jasonlam604,項目名稱:stringizer,代碼行數:11,代碼來源:LastIndexOf.php

示例4: formatShortString

 public function formatShortString($string, $maxlen = 200, $separator = '...')
 {
     $string = preg_replace('#<(?:br|p|hr|div)#', ' $0', $string);
     $string = strip_tags($string);
     $len = mb_strlen($string, 'UTF-8') > $maxlen ? mb_strripos(mb_substr($string, 0, $maxlen, 'UTF-8'), ' ', 0, 'UTF-8') : $maxlen;
     $cutStr = mb_substr($string, 0, $len, 'UTF-8');
     return mb_strlen($string, 'UTF-8') > $maxlen ? '' . $cutStr . $separator : '' . $cutStr . '';
 }
開發者ID:alexanderkuz,項目名稱:test-yii2,代碼行數:8,代碼來源:RecommendationCompanyWidget.php

示例5: cutString

function cutString($string, $maxlen)
{
    //обрезает красиво строку, убирает теги, добавляя ... в конце
    $string = strip_tags($string);
    $len = mb_strlen($string) > $maxlen ? mb_strripos(mb_substr($string, 0, $maxlen), ' ') : $maxlen;
    $cutStr = mb_substr($string, 0, $len);
    return mb_strlen($string) > $maxlen ? $cutStr . '...' : $cutStr;
}
開發者ID:arestotel,項目名稱:project,代碼行數:8,代碼來源:func.php

示例6: utf8_strripos

 public static function utf8_strripos($haystack, $needle, $offset)
 {
     if (UTF8_MBSTRING) {
         self::_fixMbStrrposPhp52($haystack, $offset);
         return mb_strripos($haystack, $needle, $offset);
     } else {
         return strripos($haystack, $needle, $offset);
     }
 }
開發者ID:Sywooch,項目名稱:forums,代碼行數:9,代碼來源:Helper.php

示例7: injectEditor

 /**
  * @param Response $response
  * @param string   $editorHtml
  */
 private function injectEditor(Response $response, $editorHtml)
 {
     $html = $response->getContent();
     $pos = mb_strripos($html, '</body>');
     if (false === $pos) {
         return;
     }
     $html = mb_substr($html, 0, $pos) . $editorHtml . mb_substr($html, $pos);
     $response->setContent($html);
 }
開發者ID:ivoaz,項目名稱:content-editable-bundle,代碼行數:14,代碼來源:EditorResponseListener.php

示例8: injectCookieBar

 protected function injectCookieBar(Response $response)
 {
     $content = $response->getContent();
     $pos = mb_strripos($content, '</body>');
     if (false !== $pos) {
         $toolbar = sprintf("\n%s\n", $this->cookieService->render());
         $content = mb_substr($content, 0, $pos) . $toolbar . mb_substr($content, $pos);
         $response->setContent($content);
     }
 }
開發者ID:vladab,項目名稱:cookie-acknowledgement-bundle,代碼行數:10,代碼來源:CookieAcknowledgementBarListener.php

示例9: fixEmbeddedAttachments

 protected function fixEmbeddedAttachments($message, $oldID, $newID)
 {
     if (mb_strripos($message, '[attach]' . $oldID . '[/attach]') !== false || mb_strripos($message, '[attach=' . $oldID . ']') !== false || mb_strripos($message, '[attach=' . $oldID . ',') !== false) {
         $message = str_ireplace('[attach]' . $oldID . '[/attach]', '[attach]' . $newID . '[/attach]', $message);
         $message = str_ireplace('[attach=' . $oldID . ']', '[attach=' . $newID . ']', $message);
         $message = str_ireplace('[attach=' . $oldID . ',', '[attach=' . $newID . ',', $message);
         return $message;
     }
     return false;
 }
開發者ID:nick-strohm,項目名稱:WCF,代碼行數:10,代碼來源:AbstractAttachmentImporter.class.php

示例10: get_words

 /**
  * Генерация слов по которым найдена акция
  * @param $news
  * @return $this
  */
 public function get_words($news)
 {
     $words = array();
     foreach ($this->_original_words as $word) {
         if (mb_strripos($news->title, $word) !== FALSE or mb_strripos($news->text, $word) !== FALSE) {
             $words[] = $word;
         }
     }
     $words = array_unique($words);
     return View::factory('frontend/search/search_words')->set('words', $words);
 }
開發者ID:Alexander711,項目名稱:naav1,代碼行數:16,代碼來源:stock.php

示例11: mb_trim_word

 /**
  * Обрезание текста по длине с поиском последнего полностью вмещающегося слова и удалением лишних крайних знаков пунктуации.
  *
  * @author Agel_Nash <Agel_Nash@xaker.ru>
  * @version 0.1
  *
  * @param string $html HTML текст
  * @param integer $len максимальная длина строки
  * @param string $encoding кодировка
  * @return string
  */
 public static function mb_trim_word($html, $len, $encoding = 'UTF-8')
 {
     $text = trim(preg_replace('|\\s+|', ' ', strip_tags($html)));
     $text = mb_substr($text, 0, $len + 1, $encoding);
     if (mb_substr($text, -1, null, $encoding) == ' ') {
         $out = trim($text);
     } else {
         $out = mb_substr($text, 0, mb_strripos($text, ' ', null, $encoding), $encoding);
     }
     return preg_replace("/(([\\.,\\-:!?;\\s])|(&\\w+;))+\$/ui", "", $out);
 }
開發者ID:AgelxNash,項目名稱:modx.evo.custom,代碼行數:22,代碼來源:APIHelpers.class.php

示例12: injectToolbar

 /**
  * @param \Symfony\Component\HttpFoundation\Response $response
  */
 protected function injectToolbar(Response $response)
 {
     $content = $response->getContent();
     $pos = mb_strripos($content, '</body>');
     if (FALSE !== $pos) {
         if ($token = $response->headers->get('X-Debug-Token')) {
             $loader = ['#theme' => 'webprofiler_loader', '#token' => $token, '#profiler_url' => $this->urlGenerator->generate('webprofiler.toolbar', ['profile' => $token])];
             $content = mb_substr($content, 0, $pos) . $this->renderer->renderRoot($loader) . mb_substr($content, $pos);
             $response->setContent($content);
         }
     }
 }
開發者ID:ddrozdik,項目名稱:dmaps,代碼行數:15,代碼來源:WebprofilerEventSubscriber.php

示例13: xyz_fbap_string_limit

 function xyz_fbap_string_limit($string, $limit)
 {
     $space = " ";
     $appendstr = " ...";
     if (mb_strlen($string) <= $limit) {
         return $string;
     }
     if (mb_strlen($appendstr) >= $limit) {
         return '';
     }
     $string = mb_substr($string, 0, $limit - mb_strlen($appendstr));
     $rpos = mb_strripos($string, $space);
     if ($rpos === false) {
         return $string . $appendstr;
     } else {
         return mb_substr($string, 0, $rpos) . $appendstr;
     }
 }
開發者ID:bichttn,項目名稱:bichttn,代碼行數:18,代碼來源:xyz-functions.php

示例14: softCut

 /**
  * Soft cutting for string
  * 
  * @param   string  $string     Source string
  * @param   integer $soft       Soft cutting position
  * @param   integer $hard       Hard cutting position
  * @param   integer $strategy   Cutting strategy [optional]
  * @param   boolean $strip      Strip tags in source [optional]
  * @param   string  $encoding   Source encoding [optional]
  * @return  string  Cutted string
  */
 public static function softCut($string, $soft, $hard, $strategy = self::CUT_STRATEGY_MIN, $strip = true, $encoding = 'utf-8')
 {
     if ($strip) {
         $string = strip_tags($string);
     }
     if (mb_strlen($string) <= $soft) {
         return $string;
     }
     $cut = mb_substr($string, 0, $hard, $encoding);
     $pos = $strategy == self::CUT_STRATEGY_MIN ? mb_stripos($cut, ' ', $soft, $encoding) : mb_strripos($cut, ' ', $soft, $encoding);
     if ($pos === false) {
         $pos = $strategy == self::CUT_STRATEGY_MIN ? mb_stripos($cut, '&nbsp;', $soft, $encoding) : mb_strripos($cut, '&nbsp;', $soft, $encoding);
     }
     if ($pos === false) {
         $pos = $strategy == self::CUT_STRATEGY_MIN ? mb_stripos($cut, ' ', $soft, $encoding) : mb_strripos($cut, ' ', $soft, $encoding);
     }
     if ($pos === false) {
         return $cut;
     }
     return mb_substr($string, 0, $pos, $encoding);
 }
開發者ID:relo-san,項目名稱:dinSymfonyExtraPlugin,代碼行數:32,代碼來源:DinFormatHelper.php

示例15: grapheme_position

 private static function grapheme_position($s, $needle, $offset, $mode)
 {
     if (!preg_match('/./us', $needle .= '')) {
         return false;
     }
     if (!preg_match('/./us', $s .= '')) {
         return false;
     }
     if ($offset > 0) {
         $s = self::grapheme_substr($s, $offset);
     } elseif ($offset < 0) {
         $offset = 0;
     }
     switch ($mode) {
         case 0:
             $needle = iconv_strpos($s, $needle, 0, 'UTF-8');
             break;
         case 1:
             $needle = mb_stripos($s, $needle, 0, 'UTF-8');
             break;
         case 2:
             $needle = iconv_strrpos($s, $needle, 'UTF-8');
             break;
         default:
             $needle = mb_strripos($s, $needle, 0, 'UTF-8');
             break;
     }
     return $needle ? self::grapheme_strlen(iconv_substr($s, 0, $needle, 'UTF-8')) + $offset : $needle;
 }
開發者ID:roberto-sanchez,項目名稱:gardencentral,代碼行數:29,代碼來源:Intl.php


注:本文中的mb_strripos函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。