substr_compare - 두 문자열을 오프셋에서 최대 길이 문자까지 이진 안전 비교
substr_compare - 두 문자열을 오프셋에서 최대 길이 문자까지 이진 안전 비교
설명 ¶
int substr_compare ( string $main_str , string $str , int $offset [, int $length [, bool $case_insensitivity= false ]])
substr_compare ()는 비교main_str 위치에서offset함께str 최대length문자.
매개 변수 ¶
main_str
비교되는 주요 문자열입니다.
str
비교되는 보조 문자열.
offset
비교의 개시 위치. 음수이면 문자열 끝에서부터 시작됩니다.
length
비교의 길이. 기본값은 길이의 가장 작은 str길이와 비교됩니다 . main_stroffset
case_insensitivity
경우 case_insensitivity이며 TRUE, 비교는 대소 문자를 구분이다.
반환 값 ¶
<경우 0을 반환 main_str위치에서 offset이하보다 str0이보다 크면> str가 동일하면, 0. 경우 offset의 길이보다 크거나 main_str, 또는이 length설정되고, 1 미만 (종래 PHP 5.5.11까지)가된다 substr_compare ()이 경고를 출력 복귀 FALSE.
변경 내역 ¶
번역 기술
5.5.11 length이제 0이 될 수 있습니다 .
5.1.0 부정적인 것을 사용할 가능성을 추가했습니다 offset.
예 ¶
Example # 1 substr_compare () 예제
<?php
echo substr_compare("abcde", "bc", 1, 2); // 0
echo substr_compare("abcde", "de", -2, 2); // 0
echo substr_compare("abcde", "bcg", 1, 2); // 0
echo substr_compare("abcde", "BC", 1, 2, true); // 0
echo substr_compare("abcde", "bc", 1, 3); // 1
echo substr_compare("abcde", "cd", 1, 2); // -1
echo substr_compare("abcde", "abc", 5, 1); // warning
?>
게시판 목록
개발자팁
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 4706 | jQuery | 8년 전 | 1517 | ||
| 4705 | jQuery | 8년 전 | 2178 | ||
| 4704 | jQuery | 8년 전 | 1711 | ||
| 4703 | jQuery | 8년 전 | 2048 | ||
| 4702 | jQuery | 8년 전 | 1837 | ||
| 4701 | jQuery | 8년 전 | 2071 | ||
| 4700 | jQuery | 8년 전 | 1749 | ||
| 4699 | jQuery | 8년 전 | 1532 | ||
| 4698 | jQuery | 8년 전 | 1340 | ||
| 4697 | jQuery | 8년 전 | 1754 | ||
| 4696 | jQuery | 8년 전 | 2374 | ||
| 4695 | jQuery | 8년 전 | 1391 | ||
| 4694 | jQuery | 8년 전 | 1804 | ||
| 4693 | jQuery | 8년 전 | 1779 | ||
| 4692 | jQuery | 8년 전 | 2570 | ||
| 4691 | jQuery | 8년 전 | 2079 | ||
| 4690 | jQuery | 8년 전 | 1970 | ||
| 4689 | jQuery | 8년 전 | 1950 | ||
| 4688 | jQuery | 8년 전 | 1707 | ||
| 4687 | jQuery | 8년 전 | 1120 | ||
| 4686 | jQuery | 8년 전 | 1753 | ||
| 4685 | jQuery | 8년 전 | 2497 | ||
| 4684 | jQuery | 8년 전 | 2375 | ||
| 4683 | jQuery | 8년 전 | 1772 | ||
| 4682 | PHP | 8년 전 | 3093 | ||
| 4681 | jQuery | 8년 전 | 1611 | ||
| 4680 | jQuery | 8년 전 | 1799 | ||
| 4679 | PHP | 8년 전 | 2025 | ||
| 4678 | PHP | 8년 전 | 2157 | ||
| 4677 | PHP | 8년 전 | 2259 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기