1--TEST--
2Test ctype_space() function : usage variations - different strings
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
5--FILE--
6<?php
7/* Prototype  : bool ctype_space(mixed $c)
8 * Description: Checks for whitespace character(s)
9 * Source code: ext/ctype/ctype.c
10 */
11
12/*
13 * Pass strings containing different character types to ctype_space() to test
14 * which are considered valid whitespace character only strings
15 */
16
17echo "*** Testing ctype_space() : 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       base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
45       "\"\n",
46/*25*/ " \t\r\n",
47/*26*/ "\v\f",
48);
49
50$iterator = 1;
51foreach($values as $value) {
52      echo "\n-- Iteration $iterator --\n";
53      var_dump( ctype_space($value) );
54      $iterator++;
55};
56
57setlocale(LC_CTYPE, $orig);
58?>
59===DONE===
60--EXPECT--
61*** Testing ctype_space() : usage variations ***
62
63-- Iteration 1 --
64bool(false)
65
66-- Iteration 2 --
67bool(false)
68
69-- Iteration 3 --
70bool(false)
71
72-- Iteration 4 --
73bool(true)
74
75-- Iteration 5 --
76bool(false)
77
78-- Iteration 6 --
79bool(false)
80
81-- Iteration 7 --
82bool(false)
83
84-- Iteration 8 --
85bool(false)
86
87-- Iteration 9 --
88bool(false)
89
90-- Iteration 10 --
91bool(true)
92
93-- Iteration 11 --
94bool(false)
95
96-- Iteration 12 --
97bool(false)
98
99-- Iteration 13 --
100bool(false)
101
102-- Iteration 14 --
103bool(false)
104
105-- Iteration 15 --
106bool(false)
107
108-- Iteration 16 --
109bool(false)
110
111-- Iteration 17 --
112bool(false)
113
114-- Iteration 18 --
115bool(false)
116
117-- Iteration 19 --
118bool(false)
119
120-- Iteration 20 --
121bool(false)
122
123-- Iteration 21 --
124bool(false)
125
126-- Iteration 22 --
127bool(true)
128
129-- Iteration 23 --
130bool(false)
131
132-- Iteration 24 --
133bool(false)
134
135-- Iteration 25 --
136bool(true)
137
138-- Iteration 26 --
139bool(true)
140===DONE===
141