本文整理汇总了PHP中Multibyte::stristr方法的典型用法代码示例。如果您正苦于以下问题:PHP Multibyte::stristr方法的具体用法?PHP Multibyte::stristr怎么用?PHP Multibyte::stristr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Multibyte
的用法示例。
在下文中一共展示了Multibyte::stristr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mb_stristr
function mb_stristr($haystack, $needle, $part = false, $encoding = null)
{
return Multibyte::stristr($haystack, $needle, $part);
}
示例2: testMultibyteStristr
/**
* testMultibyteStristr method
*
* @return void
*/
public function testMultibyteStristr()
{
$string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$find = 'f';
$result = Multibyte::stristr($string, $find);
$expected = 'FGHIJKLMNOPQRSTUVWXYZ0123456789';
$this->assertEquals($expected, $result);
$string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$find = 'f';
$result = Multibyte::stristr($string, $find, TRUE);
$expected = 'ABCDE';
$this->assertEquals($expected, $result);
$string = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ';
$find = 'å';
$result = Multibyte::stristr($string, $find);
$expected = 'ÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ';
$this->assertEquals($expected, $result);
$string = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ';
$find = 'å';
$result = Multibyte::stristr($string, $find, TRUE);
$expected = 'ÀÁÂÃÄ';
$this->assertEquals($expected, $result);
$string = 'ĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŹŻŽ';
$find = 'ċ';
$result = Multibyte::stristr($string, $find);
$expected = 'ĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŹŻŽ';
$this->assertEquals($expected, $result);
$string = 'ĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŹŻŽ';
$find = 'ċ';
$result = Multibyte::stristr($string, $find, TRUE);
$expected = 'ĀĂĄĆĈ';
$this->assertEquals($expected, $result);
$string = '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
$find = 'f';
$result = Multibyte::stristr($string, $find);
$expected = 'FGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
$this->assertEquals($expected, $result);
$string = '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
$find = 'f';
$result = Multibyte::stristr($string, $find, TRUE);
$expected = '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDE';
$this->assertEquals($expected, $result);
$string = '¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈ';
$find = 'Μ';
$result = Multibyte::stristr($string, $find);
$expected = 'µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈ';
$this->assertEquals($expected, $result);
$string = '¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈ';
$find = 'Μ';
$result = Multibyte::stristr($string, $find, TRUE);
$expected = '¡¢£¤¥¦§¨©ª«¬®¯°±²³´';
$this->assertEquals($expected, $result);
$string = 'ÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬ';
$find = 'þ';
$result = Multibyte::stristr($string, $find);
$expected = 'Þßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬ';
$this->assertEquals($expected, $result);
$string = 'ÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬ';
$find = 'þ';
$result = Multibyte::stristr($string, $find, TRUE);
$expected = 'ÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝ';
$this->assertEquals($expected, $result);
$string = 'ĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐ';
$find = 'Ņ';
$result = Multibyte::stristr($string, $find);
$expected = 'ŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐ';
$this->assertEquals($expected, $result);
$string = 'ĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐ';
$find = 'Ņ';
$result = Multibyte::stristr($string, $find, TRUE);
$expected = 'ĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃń';
$this->assertEquals($expected, $result);
$string = 'ƑƒƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƻƼƽƾƿǀǁǂǃDŽDždžLJLjljNJNjnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZDzdzǴ';
$find = 'Ƹ';
$result = Multibyte::stristr($string, $find);
$expected = 'ƸƹƺƻƼƽƾƿǀǁǂǃDŽDždžLJLjljNJNjnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZDzdzǴ';
$this->assertEquals($expected, $result);
$find = 'Ƹ';
$result = Multibyte::stristr($string, $find, TRUE);
$expected = 'ƑƒƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷ';
$this->assertEquals($expected, $result);
$string = 'əɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯʰʱʲʳʴʵʶʷʸʹʺʻʼ';
$find = 'Ʀ';
$result = Multibyte::stristr($string, $find);
$expected = 'ʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯʰʱʲʳʴʵʶʷʸʹʺʻʼ';
$this->assertEquals($expected, $result);
$string = 'əɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯʰʱʲʳʴʵʶʷʸʹʺʻʼ';
$find = 'Ʀ';
$result = Multibyte::stristr($string, $find, TRUE);
$expected = 'əɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿ';
$this->assertEquals($expected, $result);
$string = 'ЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛ';
$find = 'ї';
$result = Multibyte::stristr($string, $find);
$expected = 'ЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛ';
//.........这里部分代码省略.........
示例3: mb_stristr
/**
* Finds first occurrence of a string within another, case insensitive.
*
* @param string $haystack The string from which to get the first occurrence of $needle.
* @param string $needle The string to find in $haystack.
* @param bool $part Determines which portion of $haystack this function returns.
* If set to true, it returns all of $haystack from the beginning to the first occurrence of $needle.
* If set to false, it returns all of $haystack from the first occurrence of $needle to the end,
* Default value is false.
* @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used.
*
* @return string|bool The portion of $haystack, or false if $needle is not found.
*/
function mb_stristr($haystack, $needle, $part = FALSE, $encoding = NULL)
{
return Multibyte::stristr($haystack, $needle, $part);
}