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