1--TEST-- 2Test ctype_print() function : usage variations - different strings 3--EXTENSIONS-- 4ctype 5--FILE-- 6<?php 7/* 8 * Pass strings containing different character types to ctype_print() to test 9 * which are considered valid printable character only strings 10 */ 11 12echo "*** Testing ctype_print() : 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/*23*/ base64_decode("w4DDoMOHw6fDiMOo") // non-ascii characters 40); 41 42$iterator = 1; 43foreach($values as $value) { 44 echo "\n-- Iteration $iterator --\n"; 45 var_dump( ctype_print($value) ); 46 $iterator++; 47}; 48 49setlocale(LC_CTYPE, $orig); 50?> 51--EXPECT-- 52*** Testing ctype_print() : usage variations *** 53 54-- Iteration 1 -- 55bool(true) 56 57-- Iteration 2 -- 58bool(true) 59 60-- Iteration 3 -- 61bool(false) 62 63-- Iteration 4 -- 64bool(true) 65 66-- Iteration 5 -- 67bool(true) 68 69-- Iteration 6 -- 70bool(true) 71 72-- Iteration 7 -- 73bool(true) 74 75-- Iteration 8 -- 76bool(true) 77 78-- Iteration 9 -- 79bool(true) 80 81-- Iteration 10 -- 82bool(false) 83 84-- Iteration 11 -- 85bool(true) 86 87-- Iteration 12 -- 88bool(true) 89 90-- Iteration 13 -- 91bool(true) 92 93-- Iteration 14 -- 94bool(true) 95 96-- Iteration 15 -- 97bool(true) 98 99-- Iteration 16 -- 100bool(true) 101 102-- Iteration 17 -- 103bool(true) 104 105-- Iteration 18 -- 106bool(true) 107 108-- Iteration 19 -- 109bool(false) 110 111-- Iteration 20 -- 112bool(true) 113 114-- Iteration 21 -- 115bool(false) 116 117-- Iteration 22 -- 118bool(true) 119 120-- Iteration 23 -- 121bool(false) 122