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