strpos
페이지 정보
작성자 관리자 작성일 20-09-18 09:48 조회 6,274 댓글 0본문
(PHP 4, PHP 5, PHP 7)
strpos — Find the position of the first occurrence of a substring in a string
문자열에서 부분 문자열의 첫 번째 위치의 위치를 찾습니다.
$newstring = 'abcdef abcdef';
$pos = strpos($newstring, 'a', 1); // $pos = 7, not 0
$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);
if ($pos === false) {
echo "The string '$findme' was not found in the string '$mystring'";
} else {
echo "The string '$findme' was found in the string '$mystring'";
echo " and exists at position $pos";
}
strpos — Find the position of the first occurrence of a substring in a string
문자열에서 부분 문자열의 첫 번째 위치의 위치를 찾습니다.
$newstring = 'abcdef abcdef';
$pos = strpos($newstring, 'a', 1); // $pos = 7, not 0
$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);
if ($pos === false) {
echo "The string '$findme' was not found in the string '$mystring'";
} else {
echo "The string '$findme' was found in the string '$mystring'";
echo " and exists at position $pos";
}
댓글목록 0
등록된 댓글이 없습니다.