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