PHP strncasecmp() 함수
예시
두 문자열 비교(대소문자 구분):
<?php
echo strncasecmp("Hello world!","hello earth!",6);
?>
정의 및 사용
strncasecmp() 함수는 두 문자열을 비교합니다.
참고: strncasecmp()는 바이너리 안전하고 대소문자를 구분하지 않습니다.
팁: 이 함수는 strcasecmp( )에 길이 매개변수가 없다는 점을 제외하면 strcasecmp() 함수와 유사합니다.
통사론
strncasecmp(string1,string2,length)
매개변수 값
Parameter | Description |
---|---|
string1 | Required. Specifies the first string to compare |
string2 | Required. Specifies the second string to compare |
length | Required. Specify the number of characters from each string to be used in the comparison |
기술적 세부 사항
반환 값: | 이 함수는 다음을 반환합니다.
|
---|---|
PHP 버전: | 4.0.2+ |
더 많은 예
예시
두 문자열을 비교하십시오(대소문자 구분 안함 = Hello 및 hELLo는 동일하게 출력함).
<?php
echo strncasecmp("Hello","Hello",6);
echo "<br>";
echo strncasecmp("Hello","hELLo",6);
?>
❮ PHP 문자열 참조