1--TEST--
2Test strncasecmp() function: usage variations - case-sensitivity
3--FILE--
4<?php
5/* Test strncasecmp() function with upper-case and lower-case alphabets as inputs for 'str1' and 'str2' */
6
7echo "*** Test strncasecmp() function: with alphabets ***\n";
8echo "-- Passing upper-case letters for 'str1' --\n";
9for($ASCII = 65; $ASCII <= 90; $ASCII++) {
10  var_dump( strncasecmp( chr($ASCII), chr($ASCII), 1 ) );  //comparing uppercase letter with corresponding uppercase letter; exp: int(0)
11  var_dump( strncasecmp( chr($ASCII), chr($ASCII + 32), 1 ) );  //comparing uppercase letter with corresponding lowercase letter; exp: int(0)
12}
13
14echo "\n-- Passing lower-case letters for 'str1' --\n";
15for($ASCII = 97; $ASCII <= 122; $ASCII++) {
16  var_dump( strncasecmp( chr($ASCII), chr($ASCII), 1 ) );  //comparing lowercase letter with corresponding lowercase letter; exp: int(0)
17  var_dump( strncasecmp( chr($ASCII), chr($ASCII - 32), 1 ) );  //comparing lowercase letter with corresponding uppercase letter; exp: int(0)
18}
19echo "*** Done ***\n";
20?>
21--EXPECT--
22*** Test strncasecmp() function: with alphabets ***
23-- Passing upper-case letters for 'str1' --
24int(0)
25int(0)
26int(0)
27int(0)
28int(0)
29int(0)
30int(0)
31int(0)
32int(0)
33int(0)
34int(0)
35int(0)
36int(0)
37int(0)
38int(0)
39int(0)
40int(0)
41int(0)
42int(0)
43int(0)
44int(0)
45int(0)
46int(0)
47int(0)
48int(0)
49int(0)
50int(0)
51int(0)
52int(0)
53int(0)
54int(0)
55int(0)
56int(0)
57int(0)
58int(0)
59int(0)
60int(0)
61int(0)
62int(0)
63int(0)
64int(0)
65int(0)
66int(0)
67int(0)
68int(0)
69int(0)
70int(0)
71int(0)
72int(0)
73int(0)
74int(0)
75int(0)
76
77-- Passing lower-case letters for 'str1' --
78int(0)
79int(0)
80int(0)
81int(0)
82int(0)
83int(0)
84int(0)
85int(0)
86int(0)
87int(0)
88int(0)
89int(0)
90int(0)
91int(0)
92int(0)
93int(0)
94int(0)
95int(0)
96int(0)
97int(0)
98int(0)
99int(0)
100int(0)
101int(0)
102int(0)
103int(0)
104int(0)
105int(0)
106int(0)
107int(0)
108int(0)
109int(0)
110int(0)
111int(0)
112int(0)
113int(0)
114int(0)
115int(0)
116int(0)
117int(0)
118int(0)
119int(0)
120int(0)
121int(0)
122int(0)
123int(0)
124int(0)
125int(0)
126int(0)
127int(0)
128int(0)
129int(0)
130*** Done ***
131