xref: /PHP-8.1/ext/ctype/tests/001.phpt (revision 08069165)
1--TEST--
2ctype on integers
3--EXTENSIONS--
4ctype
5--INI--
6error_reporting=E_ALL&~E_DEPRECATED
7--FILE--
8<?php
9setlocale(LC_ALL,"C");
10
11function ctype_test_001($function) {
12    $n=0;
13    for($a=0;$a<256;$a++) {
14        if($function($a)) $n++;
15    }
16    echo "$function $n\n";
17}
18
19ctype_test_001("ctype_lower");
20ctype_test_001("ctype_upper");
21ctype_test_001("ctype_alpha");
22ctype_test_001("ctype_digit");
23ctype_test_001("ctype_alnum");
24ctype_test_001("ctype_cntrl");
25ctype_test_001("ctype_graph");
26ctype_test_001("ctype_print");
27ctype_test_001("ctype_punct");
28ctype_test_001("ctype_space");
29ctype_test_001("ctype_xdigit");
30?>
31--EXPECT--
32ctype_lower 26
33ctype_upper 26
34ctype_alpha 52
35ctype_digit 10
36ctype_alnum 62
37ctype_cntrl 33
38ctype_graph 94
39ctype_print 95
40ctype_punct 32
41ctype_space 6
42ctype_xdigit 22
43