strpos > Web 끄적임

본문 바로가기

사이트 내 전체검색

뒤로가기 뒤로가기

Web 끄적임

PHP strpos

페이지 정보

작성자 관리자 작성일 20-09-18 09:48 조회 9,910 댓글 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";
}
추천0 비추천 0

댓글목록 0

등록된 댓글이 없습니다.

Copyright © NEION All rights reserved.
PC 버전으로 보기