strripos

(PHP 5, PHP 7)

strripos锟斤拷锟斤拷指锟斤拷锟街凤拷锟斤拷锟斤拷目锟斤拷锟街凤拷锟斤拷锟斤拷锟斤拷锟揭伙拷纬锟斤拷值锟轿伙拷茫锟斤拷锟斤拷锟斤拷执锟叫⌒达拷锟�

说锟斤拷

strripos ( string $haystack , string $needle [, int $offset = 0 ] ) : int

锟皆诧拷锟斤拷锟街达拷小写锟侥凤拷式锟斤拷锟斤拷指锟斤拷锟街凤拷锟斤拷锟斤拷目锟斤拷锟街凤拷锟斤拷锟斤拷锟斤拷锟揭伙拷纬锟斤拷值锟轿伙拷谩锟斤拷锟� strrpos() 锟斤拷同锟斤拷strripos() 锟斤拷锟斤拷锟街达拷小写锟斤拷

锟斤拷锟斤拷

haystack

锟节达拷锟街凤拷锟斤拷锟叫斤拷锟叫诧拷锟揭★拷

needle

注锟斤拷 needle 锟斤拷锟斤拷锟斤拷一锟斤拷锟斤拷锟街凤拷锟斤拷锟竭讹拷锟街凤拷锟斤拷锟街凤拷锟斤拷锟斤拷

offset

锟斤拷锟斤拷 offset 锟斤拷锟皆憋拷指锟斤拷锟斤拷锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷锟斤拷锟解长锟饺碉拷锟斤拷锟街凤拷锟斤拷锟斤拷

锟斤拷锟斤拷偏锟斤拷锟斤拷锟斤拷使锟矫诧拷锟揭达拷锟街凤拷锟斤拷锟斤拷锟斤拷始位锟矫匡拷始锟斤拷锟斤拷 offset 位锟斤拷为止锟斤拷

锟斤拷锟斤拷值

锟斤拷锟斤拷 needle 锟斤拷锟斤拷锟� haystack 锟街凤拷锟斤拷锟斤拷位锟斤拷(锟斤拷锟斤拷锟斤拷锟侥凤拷锟斤拷锟狡拷锟斤拷锟斤拷薰锟�)锟斤拷同时注锟斤拷锟街凤拷锟斤拷锟斤拷锟斤拷始位锟斤拷为 0 锟斤拷锟斤拷 1锟斤拷

锟斤拷锟� needle 未锟斤拷锟斤拷锟街o拷锟斤拷锟斤拷 FALSE锟斤拷

Warning

锟剿猴拷锟斤拷锟斤拷锟杰凤拷锟截诧拷锟斤拷值 FALSE锟斤拷锟斤拷也锟斤拷锟杰凤拷锟截碉拷同锟斤拷 FALSE 锟侥非诧拷锟斤拷值锟斤拷锟斤拷锟侥讹拷 锟斤拷锟斤拷锟斤拷锟斤拷锟铰斤拷锟皆伙拷取锟斤拷锟斤拷锟斤拷息锟斤拷应使锟斤拷 === 锟斤拷锟斤拷锟�锟斤拷锟斤拷锟皆此猴拷锟斤拷锟侥凤拷锟斤拷值锟斤拷

锟斤拷锟斤拷

Example #1 strripos() 锟津单凤拷锟斤拷

<?php
$haystack 
'ababcd';
$needle   'aB';

$pos      strripos($haystack$needle);

if (
$pos === false) {
    echo 
"Sorry, we did not find ($needle) in ($haystack)";
} else {
    echo 
"Congratulations!\n";
    echo 
"We found the last ($needle) in ($haystack) at position ($pos)";
}
?>

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

   Congratulations!
   We found the last (aB) in (ababcd) at position (2)

锟轿硷拷

  • strpos() - 锟斤拷锟斤拷锟街凤拷锟斤拷锟阶次筹拷锟街碉拷位锟斤拷
  • stripos() - 锟斤拷锟斤拷锟街凤拷锟斤拷锟阶次筹拷锟街碉拷位锟矫o拷锟斤拷锟斤拷锟街达拷小写锟斤拷
  • strrchr() - 锟斤拷锟斤拷指锟斤拷锟街凤拷锟斤拷锟街凤拷锟斤拷锟叫碉拷锟斤拷锟揭伙拷纬锟斤拷锟�
  • substr() - 锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷锟接达拷
  • stristr() - strstr 锟斤拷锟斤拷锟侥猴拷锟皆达拷小写锟芥本
  • strstr() - 锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷锟阶次筹拷锟斤拷