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


PHP UTF8::strrpos方法代碼示例

本文整理匯總了PHP中UTF8::strrpos方法的典型用法代碼示例。如果您正苦於以下問題:PHP UTF8::strrpos方法的具體用法?PHP UTF8::strrpos怎麽用?PHP UTF8::strrpos使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UTF8的用法示例。


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

示例1: _strrpos

/**
 * UTF8::strrpos
 *
 * @package    Kohana
 * @author     Kohana Team
 * @copyright  (c) 2007-2012 Kohana Team
 * @copyright  (c) 2005 Harry Fuecks
 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
 */
function _strrpos($str, $search, $offset = 0)
{
    $offset = (int) $offset;
    if (UTF8::is_ascii($str) and UTF8::is_ascii($search)) {
        return strrpos($str, $search, $offset);
    }
    if ($offset == 0) {
        $array = explode($search, $str, -1);
        return isset($array[0]) ? UTF8::strlen(implode($search, $array)) : FALSE;
    }
    $str = UTF8::substr($str, $offset);
    $pos = UTF8::strrpos($str, $search);
    return $pos === FALSE ? FALSE : $pos + $offset;
}
開發者ID:EhteshamMehmood,項目名稱:BlogMVC,代碼行數:23,代碼來源:strrpos.php

示例2: test_strrpos

 /**
  * Tests UTF8::strrpos
  *
  * @test
  * @dataProvider provider_strrpos
  */
 public function test_strrpos($input, $str, $offset, $expected)
 {
     $this->assertSame($expected, UTF8::strrpos($input, $str, $offset));
     UTF8::$server_utf8 = !UTF8::$server_utf8;
     $this->assertSame($expected, UTF8::strrpos($input, $str, $offset));
     UTF8::$server_utf8 = !UTF8::$server_utf8;
 }
開發者ID:azuya,項目名稱:Wi3,代碼行數:13,代碼來源:UTF8Test.php

示例3: strrpos

 /**
  * Finds position of last occurrence of a char in a UTF-8 string. This is
  * a UTF8-aware version of [strrpos](http://php.net/strrpos).
  *
  * $position = UTF8::strrpos($str, $search);
  *
  * @author  Harry Fuecks <hfuecks@gmail.com>
  * @param   string   haystack
  * @param   string   needle
  * @param   integer  offset from which character in haystack to start searching
  * @return  integer  position of needle
  * @return  boolean  FALSE if the needle is not found
  * @uses	IS_MBSTRING
  */
 public static function strrpos($str, $search, $offset = 0)
 {
     $offset = (int) $offset;
     if (IS_MBSTRING) {
         return mb_strrpos($str, $search, $offset, Core::$charset);
     }
     if (UTF8::is_ascii($str) and UTF8::is_ascii($search)) {
         return strrpos($str, $search, $offset);
     }
     if ($offset == 0) {
         $array = explode($search, $str, -1);
         return isset($array[0]) ? UTF8::strlen(implode($search, $array)) : FALSE;
     }
     $str = UTF8::substr($str, $offset);
     $pos = UTF8::strrpos($str, $search);
     return $pos === FALSE ? FALSE : $pos + $offset;
 }
開發者ID:xiaodin1,項目名稱:myqee,代碼行數:31,代碼來源:utf8.class.php

示例4: test_strrpos

 /**
  * Tests UTF8::strrpos
  *
  * @test
  * @dataProvider provider_strrpos
  */
 public function test_strrpos($input, $str, $offset, $expected)
 {
     $this->assertSame($expected, UTF8::strrpos($input, $str, $offset));
 }
開發者ID:reznikds,項目名稱:Reznik,代碼行數:10,代碼來源:UTF8Test.php


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