1--TEST--
2Test strtoupper() function
3--FILE--
4<?php
5echo "*** Testing strtoupper() with 256 chars ***\n";
6for ($i=0; $i<=255; $i++){
7  $char = chr($i);
8  print(bin2hex($char))." => ".(bin2hex(strtoupper("$char")))."\n";
9}
10
11echo "\n*** Testing strtoupper() with basic strings ***\n";
12$str = "Mary Had A liTTle LAmb and ShE loveD IT So\n";
13var_dump(strtoupper($str));
14
15echo "\n*** Testing strtoupper() with various strings ***";
16/* strings to pass strtoupper() */
17$strings = array (
18  "",
19  "string",
20  "stRINg0234",
21  "1.233.344StrinG12333",
22  "$$$$$$!!!!@@@@@@@ ABCDEF !!!***",
23  "ABCD\0abcdABCD",
24  TRUE,
25  FALSE,
26  /* Check for off-by-one errors in the SSE implementation */
27  "aaaaaaaaaaaaaaaaaaaa",
28  "zzzzzzzzzzzzzzzzzzzz",
29  "````````````````````",
30  "{{{{{{{{{{{{{{{{{{{{",
31);
32
33$count = 0;
34/* loop through to check possible variations */
35foreach ($strings as $string) {
36  echo "\n-- Iteration $count --\n";
37  var_dump( strtoupper($string) );
38  $count++;
39}
40
41echo "\n*** Testing strtoupper() with two different case strings ***\n";
42if (strtoupper("HeLLo woRLd") === strtoupper("hEllo WORLD"))
43  echo "strings are same, with Case Insensitive\n";
44else
45  echo "strings are not same\n";
46
47echo "*** Done ***";
48?>
49--EXPECTF--
50*** Testing strtoupper() with 256 chars ***
5100 => 00
5201 => 01
5302 => 02
5403 => 03
5504 => 04
5605 => 05
5706 => 06
5807 => 07
5908 => 08
6009 => 09
610a => 0a
620b => 0b
630c => 0c
640d => 0d
650e => 0e
660f => 0f
6710 => 10
6811 => 11
6912 => 12
7013 => 13
7114 => 14
7215 => 15
7316 => 16
7417 => 17
7518 => 18
7619 => 19
771a => 1a
781b => 1b
791c => 1c
801d => 1d
811e => 1e
821f => 1f
8320 => 20
8421 => 21
8522 => 22
8623 => 23
8724 => 24
8825 => 25
8926 => 26
9027 => 27
9128 => 28
9229 => 29
932a => 2a
942b => 2b
952c => 2c
962d => 2d
972e => 2e
982f => 2f
9930 => 30
10031 => 31
10132 => 32
10233 => 33
10334 => 34
10435 => 35
10536 => 36
10637 => 37
10738 => 38
10839 => 39
1093a => 3a
1103b => 3b
1113c => 3c
1123d => 3d
1133e => 3e
1143f => 3f
11540 => 40
11641 => 41
11742 => 42
11843 => 43
11944 => 44
12045 => 45
12146 => 46
12247 => 47
12348 => 48
12449 => 49
1254a => 4a
1264b => 4b
1274c => 4c
1284d => 4d
1294e => 4e
1304f => 4f
13150 => 50
13251 => 51
13352 => 52
13453 => 53
13554 => 54
13655 => 55
13756 => 56
13857 => 57
13958 => 58
14059 => 59
1415a => 5a
1425b => 5b
1435c => 5c
1445d => 5d
1455e => 5e
1465f => 5f
14760 => 60
14861 => 41
14962 => 42
15063 => 43
15164 => 44
15265 => 45
15366 => 46
15467 => 47
15568 => 48
15669 => 49
1576a => 4a
1586b => 4b
1596c => 4c
1606d => 4d
1616e => 4e
1626f => 4f
16370 => 50
16471 => 51
16572 => 52
16673 => 53
16774 => 54
16875 => 55
16976 => 56
17077 => 57
17178 => 58
17279 => 59
1737a => 5a
1747b => 7b
1757c => 7c
1767d => 7d
1777e => 7e
1787f => 7f
17980 => 80
18081 => 81
18182 => 82
18283 => 83
18384 => 84
18485 => 85
18586 => 86
18687 => 87
18788 => 88
18889 => 89
1898a => 8a
1908b => 8b
1918c => 8c
1928d => 8d
1938e => 8e
1948f => 8f
19590 => 90
19691 => 91
19792 => 92
19893 => 93
19994 => 94
20095 => 95
20196 => 96
20297 => 97
20398 => 98
20499 => 99
2059a => 9a
2069b => 9b
2079c => 9c
2089d => 9d
2099e => 9e
2109f => 9f
211a0 => a0
212a1 => a1
213a2 => a2
214a3 => a3
215a4 => a4
216a5 => a5
217a6 => a6
218a7 => a7
219a8 => a8
220a9 => a9
221aa => aa
222ab => ab
223ac => ac
224ad => ad
225ae => ae
226af => af
227b0 => b0
228b1 => b1
229b2 => b2
230b3 => b3
231b4 => b4
232b5 => b5
233b6 => b6
234b7 => b7
235b8 => b8
236b9 => b9
237ba => ba
238bb => bb
239bc => bc
240bd => bd
241be => be
242bf => bf
243c0 => c0
244c1 => c1
245c2 => c2
246c3 => c3
247c4 => c4
248c5 => c5
249c6 => c6
250c7 => c7
251c8 => c8
252c9 => c9
253ca => ca
254cb => cb
255cc => cc
256cd => cd
257ce => ce
258cf => cf
259d0 => d0
260d1 => d1
261d2 => d2
262d3 => d3
263d4 => d4
264d5 => d5
265d6 => d6
266d7 => d7
267d8 => d8
268d9 => d9
269da => da
270db => db
271dc => dc
272dd => dd
273de => de
274df => df
275e0 => e0
276e1 => e1
277e2 => e2
278e3 => e3
279e4 => e4
280e5 => e5
281e6 => e6
282e7 => e7
283e8 => e8
284e9 => e9
285ea => ea
286eb => eb
287ec => ec
288ed => ed
289ee => ee
290ef => ef
291f0 => f0
292f1 => f1
293f2 => f2
294f3 => f3
295f4 => f4
296f5 => f5
297f6 => f6
298f7 => f7
299f8 => f8
300f9 => f9
301fa => fa
302fb => fb
303fc => fc
304fd => fd
305fe => fe
306ff => ff
307
308*** Testing strtoupper() with basic strings ***
309string(43) "MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
310"
311
312*** Testing strtoupper() with various strings ***
313-- Iteration 0 --
314string(0) ""
315
316-- Iteration 1 --
317string(6) "STRING"
318
319-- Iteration 2 --
320string(10) "STRING0234"
321
322-- Iteration 3 --
323string(20) "1.233.344STRING12333"
324
325-- Iteration 4 --
326string(31) "$$$$$$!!!!@@@@@@@ ABCDEF !!!***"
327
328-- Iteration 5 --
329string(13) "ABCD%0ABCDABCD"
330
331-- Iteration 6 --
332string(1) "1"
333
334-- Iteration 7 --
335string(0) ""
336
337-- Iteration 8 --
338string(20) "AAAAAAAAAAAAAAAAAAAA"
339
340-- Iteration 9 --
341string(20) "ZZZZZZZZZZZZZZZZZZZZ"
342
343-- Iteration 10 --
344string(20) "````````````````````"
345
346-- Iteration 11 --
347string(20) "{{{{{{{{{{{{{{{{{{{{"
348
349*** Testing strtoupper() with two different case strings ***
350strings are same, with Case Insensitive
351*** Done ***
352