(PHP 5, PHP 7)
strripos — 문자열에서 대소문자 구분 없이 문자열의 마지막 위치를 찾습니다
$haystack
, string $needle
[, int $offset
] )문자열에서 대소문자 구분 없는 문자열의 마지막 위치를 찾습니다. strrpos()와는 달리, strripos()는 대소문자를 구분하지 않습니다.
haystack탐색할 문자열
needle
needle은 문자열이나 하나 이상의 문자이여야
합니다.
offset
offset 인수를 지정하면 문자열의 해당
위치에서부터 탐색을 시작합니다.
음의 offset 값은 문자열 시작부터
offset 문자에서 탐색을 시작합니다.
needle의 마지막 위치를 반환합니다. 문자열 위치는
1이 아닌, 0에서 시작합니다.
needle을 발견하지 못하면, 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)