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


PHP Utf8::strripos方法代碼示例

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


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

示例1: testStrpos

 /**
  * @covers Patchwork\Utf8::strpos
  * @covers Patchwork\Utf8::stripos
  * @covers Patchwork\Utf8::strrpos
  * @covers Patchwork\Utf8::strripos
  */
 function testStrpos()
 {
     $this->assertSame(false, u::strpos('abc', ''));
     $this->assertSame(false, u::strpos('abc', 'd'));
     $this->assertSame(false, u::strpos('abc', 'a', 3));
     $this->assertSame(0, u::strpos('abc', 'a', -1));
     $this->assertSame(1, u::strpos('한국어', '국'));
     $this->assertSame(3, u::stripos('DÉJÀ', 'à'));
     $this->assertSame(1, u::stripos('aςσb', 'ΣΣ'));
     $this->assertSame(false, u::strrpos('한국어', ''));
     $this->assertSame(1, u::strrpos('한국어', '국'));
     $this->assertSame(3, u::strripos('DÉJÀ', 'à'));
     $this->assertSame(1, u::strripos('aςσb', 'ΣΣ'));
     $this->assertSame(16, u::stripos('der Straße nach Paris', 'Paris'));
 }
開發者ID:nicolas-grekas,項目名稱:Patchwork-sandbox,代碼行數:21,代碼來源:Utf8Test.php

示例2: api_strripos

/**
 * Finds the position of last occurrence (case insensitive) of a string in a string.
 * @param string $haystack				The string from which to get the position of the last occurrence.
 * @param string $needle				The string to be found.
 * @param int $offset (optional)		$offset may be specified to begin searching an arbitrary position. Negative values will stop searching at an arbitrary point prior to the end of the string.
 * @param string $encoding (optional)	The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
 * @return mixed						Returns the numeric position of the first occurrence (case insensitive) of $needle in the $haystack, or FALSE if $needle is not found.
 * Note: The first character's position is 0, the second character position is 1, and so on.
 * This function is aimed at replacing the functions strripos() and mb_strripos() for human-language strings.
 * @link http://php.net/manual/en/function.strripos
 * @link http://php.net/manual/en/function.mb-strripos
 */
function api_strripos($haystack, $needle, $offset = 0, $encoding = null)
{
    return Utf8::strripos($haystack, $needle, $offset);
}
開發者ID:KRCM13,項目名稱:chamilo-lms,代碼行數:16,代碼來源:internationalization.lib.php


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