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에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 4556 | jQuery |
프로그래머7
|
8년 전 | 1691 | |
| 4555 | jQuery |
프로그래머7
|
8년 전 | 1609 | |
| 4554 | jQuery |
프로그래머7
|
8년 전 | 1662 | |
| 4553 | jQuery |
프로그래머7
|
8년 전 | 2041 | |
| 4552 | PHP | 8년 전 | 1880 | ||
| 4551 | PHP | 8년 전 | 1467 | ||
| 4550 | PHP | 8년 전 | 1708 | ||
| 4549 | jQuery |
프로그래머7
|
8년 전 | 2744 | |
| 4548 | jQuery |
프로그래머7
|
8년 전 | 1442 | |
| 4547 | jQuery |
프로그래머7
|
8년 전 | 1367 | |
| 4546 | jQuery |
프로그래머7
|
8년 전 | 1684 | |
| 4545 | jQuery |
프로그래머7
|
8년 전 | 1710 | |
| 4544 | jQuery |
프로그래머7
|
8년 전 | 1866 | |
| 4543 | jQuery |
프로그래머7
|
8년 전 | 1653 | |
| 4542 | jQuery |
프로그래머7
|
8년 전 | 1584 | |
| 4541 | jQuery |
프로그래머7
|
8년 전 | 1633 | |
| 4540 | jQuery |
프로그래머7
|
8년 전 | 1666 | |
| 4539 | jQuery |
프로그래머7
|
8년 전 | 1863 | |
| 4538 | jQuery |
프로그래머7
|
8년 전 | 1536 | |
| 4537 | jQuery |
프로그래머7
|
8년 전 | 1697 | |
| 4536 | jQuery |
프로그래머7
|
8년 전 | 1936 | |
| 4535 | jQuery |
프로그래머7
|
8년 전 | 1520 | |
| 4534 | jQuery |
프로그래머7
|
8년 전 | 1855 | |
| 4533 | jQuery |
프로그래머7
|
8년 전 | 2344 | |
| 4532 | jQuery |
프로그래머7
|
8년 전 | 1917 | |
| 4531 | PHP |
|
8년 전 | 3712 | |
| 4530 | jQuery |
프로그래머7
|
8년 전 | 1800 | |
| 4529 | jQuery |
프로그래머7
|
8년 전 | 1901 | |
| 4528 | jQuery |
프로그래머7
|
8년 전 | 1699 | |
| 4527 | jQuery |
|
8년 전 | 2699 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기