strpos > PHP

본문 바로가기
사이트 내 전체검색

PHP

strpos

페이지 정보

profile_image
작성자 관리자
댓글 0건 조회 6,183회 작성일 20-09-18 09:48

본문

(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";
 }

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

Copyright © neion.co.kr All rights reserved.