当前位置: 首页>>代码示例>>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;未经允许,请勿转载。