Strings strpbrk
(PHP 5, PHP 7, PHP 8)
strpbrk — 임의의 문자 집합에 대한 문자열 검색
설명
strpbrk(string $string
, string $characters
): string|false
strpbrk()는 string
문자열에서 characters
를 검색합니다.
매개변수
string
characters
를 찾는 문자열입니다.characters
- 이 매개변수는 대소문자를 구분합니다.
반환 값
찾은 문자에서 시작하는 문자열을 반환하고, 찾지 못하면 false
를 반환합니다.
Examples
예제 #1 strpbrk() 예제
<?php
$text = 'This is a Simple text.';
// this echoes "is is a Simple text." because 'i' is matched first
echo strpbrk($text, 'mi');
// this echoes "Simple text." because chars are case sensitive
echo strpbrk($text, 'S');
?>
기타
- strpos() - 문자열에서 부분 문자열이 처음 나타나는 위치 찾기
- strstr() - 문자열의 첫 번째 항목 찾기
- preg_match() - 정규식 일치 수행