1--TEST--
2Test ctype_graph() function : usage variations - different strings
3--EXTENSIONS--
4ctype
5--FILE--
6<?php
7/*
8 * Pass strings containing different character types to ctype_graph() to test
9 * which are considered valid printable character only strings
10 */
11
12echo "*** Testing ctype_graph() : usage variations ***\n";
13
14$orig = setlocale(LC_CTYPE, "C");
15
16$values = array(
17/*1*/  "This string contains just letters and spaces", // Simple string
18       "but this one contains some numbers too 123+456 = 678", // Mixed string
19       "",
20       " ",
21/*5*/  "a",
22       "ABCXYZ",
23       "abcxyz",
24       "ABCXYZ123DEF456",
25       "abczyz123DEF456",
26/*10*/ "\r\n",
27       "123",
28       "03F", // hexadecimal 'digits'
29       ")speci@! ch@r$(",
30       '@!$*',
31/*15*/ 'ABC',
32       'abc',
33       'ABC123',
34       'abc123',
35       "abc123\n",
36/*20*/ 'abc 123',
37       '',
38       ' ',
39       base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
40       "!$%^&*()_+-={}[]:;@~'#<,>.?/",
41/*25*/ "\"ABC\"",
42       "String\twith\ttabs",
43       "Sample string with newline\n",
44/*28*/ "123 ABC XYZ",
45);
46
47$iterator = 1;
48foreach($values as $value) {
49      echo "\n-- Iteration $iterator --\n";
50      var_dump( ctype_graph($value) );
51      $iterator++;
52};
53
54setlocale(LC_CTYPE, $orig);
55?>
56--EXPECT--
57*** Testing ctype_graph() : usage variations ***
58
59-- Iteration 1 --
60bool(false)
61
62-- Iteration 2 --
63bool(false)
64
65-- Iteration 3 --
66bool(false)
67
68-- Iteration 4 --
69bool(false)
70
71-- Iteration 5 --
72bool(true)
73
74-- Iteration 6 --
75bool(true)
76
77-- Iteration 7 --
78bool(true)
79
80-- Iteration 8 --
81bool(true)
82
83-- Iteration 9 --
84bool(true)
85
86-- Iteration 10 --
87bool(false)
88
89-- Iteration 11 --
90bool(true)
91
92-- Iteration 12 --
93bool(true)
94
95-- Iteration 13 --
96bool(false)
97
98-- Iteration 14 --
99bool(true)
100
101-- Iteration 15 --
102bool(true)
103
104-- Iteration 16 --
105bool(true)
106
107-- Iteration 17 --
108bool(true)
109
110-- Iteration 18 --
111bool(true)
112
113-- Iteration 19 --
114bool(false)
115
116-- Iteration 20 --
117bool(false)
118
119-- Iteration 21 --
120bool(false)
121
122-- Iteration 22 --
123bool(false)
124
125-- Iteration 23 --
126bool(false)
127
128-- Iteration 24 --
129bool(true)
130
131-- Iteration 25 --
132bool(true)
133
134-- Iteration 26 --
135bool(false)
136
137-- Iteration 27 --
138bool(false)
139
140-- Iteration 28 --
141bool(false)
142