Ctype ctype_graph

(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)

ctype_graph — 공백을 제외한 인쇄 가능한 문자 확인


설명

ctype_graph(mixed $text): bool

제공된 문자열 text의 모든 문자가 가시적인 출력을 생성하는지 확인합니다.


매개변수

text
테스트한 문자열입니다.

메모: -128에서 255 사이의 int가 제공되면 단일 문자의 ASCII 값으로 해석됩니다(음수 값에는 확장 ASCII 범위의 문자를 허용하기 위해 256이 추가됨). 다른 모든 정수는 정수의 십진수를 포함하는 문자열로 해석됩니다.

경고 PHP 8.1.0부터 문자열이 아닌 인수를 전달하는 것은 더 이상 사용되지 않습니다. 앞으로 인수는 ASCII 코드 포인트 대신 문자열로 해석됩니다. 의도한 동작에 따라 인수를 문자열로 캐스팅하거나 chr()을 명시적으로 호출해야 합니다.


반환 값

text의 모든 문자가 인쇄 가능하고 실제로 보이는 출력(공백 없음)을 생성하면 true를 반환하고 그렇지 않으면 false를 반환합니다. 빈 문자열로 호출하면 결과는 항상 false입니다.


Examples

예제 #1 ctype_graph() 예제

                  
<?php
$strings = array('string1' => "asdf\n\r\t", 'string2' => 'arf12', 'string3' => 'LKA#@%.54');
foreach ($strings as $name => $testcase) {
    if (ctype_graph($testcase)) {
        echo "The string '$name' consists of all (visibly) printable characters.\n";
    } else {
        echo "The string '$name' does not consist of all (visibly) printable characters.\n";
    }
}
?>
                  
                

위의 예는 다음을 출력합니다.

The string 'string1' does not consist of all (visibly) printable characters.
The string 'string2' consists of all (visibly) printable characters.
The string 'string3' consists of all (visibly) printable characters.
                

기타