1--TEST-- 2Test strtolower() function 3--FILE-- 4<?php 5 6echo "*** Testing strtolower() with 256 chars ***\n"; 7for ($i=0; $i<=255; $i++){ 8 $char = chr($i); 9 print(bin2hex($char))." => ".(bin2hex(strtolower("$char")))."\n"; 10} 11 12echo "*** Testing strlower() with basic strings ***\n"; 13$str = "Mary Had A liTTle LAmb and ShE loveD IT So\n"; 14var_dump(strtolower($str)); 15 16echo "\n*** Testing strtolower() with various strings ***"; 17/* strings to pass strtolower() */ 18$strings = array ( 19 "", 20 "string", 21 "stRINg0234", 22 "1.233.344StrinG12333", 23 "$$$$$$!!!!@@@@@@@ ABCDEF !!!***", 24 "ABCD\0abcdABCD", 25 TRUE, 26 FALSE, 27 28 /* Check for off-by-one errors in the SSE implementation */ 29 "AAAAAAAAAAAAAAAAAAAA", 30 "ZZZZZZZZZZZZZZZZZZZZ", 31 "@@@@@@@@@@@@@@@@@@@@", 32 "[[[[[[[[[[[[[[[[[[[[", 33); 34 35$count = 0; 36/* loop through to check possible variations */ 37foreach ($strings as $string) { 38 echo "\n-- Iteration $count --\n"; 39 var_dump( strtolower($string) ); 40 $count++; 41} 42 43echo "\n*** Testing strtolower() with two different case strings ***\n"; 44if (strtolower("HeLLo woRLd") === strtolower("hEllo WORLD")) 45 echo "strings are same, with Case Insensitive\n"; 46else 47 echo "strings are not same\n"; 48 49echo "*** Done ***"; 50?> 51--EXPECTF-- 52*** Testing strtolower() with 256 chars *** 5300 => 00 5401 => 01 5502 => 02 5603 => 03 5704 => 04 5805 => 05 5906 => 06 6007 => 07 6108 => 08 6209 => 09 630a => 0a 640b => 0b 650c => 0c 660d => 0d 670e => 0e 680f => 0f 6910 => 10 7011 => 11 7112 => 12 7213 => 13 7314 => 14 7415 => 15 7516 => 16 7617 => 17 7718 => 18 7819 => 19 791a => 1a 801b => 1b 811c => 1c 821d => 1d 831e => 1e 841f => 1f 8520 => 20 8621 => 21 8722 => 22 8823 => 23 8924 => 24 9025 => 25 9126 => 26 9227 => 27 9328 => 28 9429 => 29 952a => 2a 962b => 2b 972c => 2c 982d => 2d 992e => 2e 1002f => 2f 10130 => 30 10231 => 31 10332 => 32 10433 => 33 10534 => 34 10635 => 35 10736 => 36 10837 => 37 10938 => 38 11039 => 39 1113a => 3a 1123b => 3b 1133c => 3c 1143d => 3d 1153e => 3e 1163f => 3f 11740 => 40 11841 => 61 11942 => 62 12043 => 63 12144 => 64 12245 => 65 12346 => 66 12447 => 67 12548 => 68 12649 => 69 1274a => 6a 1284b => 6b 1294c => 6c 1304d => 6d 1314e => 6e 1324f => 6f 13350 => 70 13451 => 71 13552 => 72 13653 => 73 13754 => 74 13855 => 75 13956 => 76 14057 => 77 14158 => 78 14259 => 79 1435a => 7a 1445b => 5b 1455c => 5c 1465d => 5d 1475e => 5e 1485f => 5f 14960 => 60 15061 => 61 15162 => 62 15263 => 63 15364 => 64 15465 => 65 15566 => 66 15667 => 67 15768 => 68 15869 => 69 1596a => 6a 1606b => 6b 1616c => 6c 1626d => 6d 1636e => 6e 1646f => 6f 16570 => 70 16671 => 71 16772 => 72 16873 => 73 16974 => 74 17075 => 75 17176 => 76 17277 => 77 17378 => 78 17479 => 79 1757a => 7a 1767b => 7b 1777c => 7c 1787d => 7d 1797e => 7e 1807f => 7f 18180 => 80 18281 => 81 18382 => 82 18483 => 83 18584 => 84 18685 => 85 18786 => 86 18887 => 87 18988 => 88 19089 => 89 1918a => 8a 1928b => 8b 1938c => 8c 1948d => 8d 1958e => 8e 1968f => 8f 19790 => 90 19891 => 91 19992 => 92 20093 => 93 20194 => 94 20295 => 95 20396 => 96 20497 => 97 20598 => 98 20699 => 99 2079a => 9a 2089b => 9b 2099c => 9c 2109d => 9d 2119e => 9e 2129f => 9f 213a0 => a0 214a1 => a1 215a2 => a2 216a3 => a3 217a4 => a4 218a5 => a5 219a6 => a6 220a7 => a7 221a8 => a8 222a9 => a9 223aa => aa 224ab => ab 225ac => ac 226ad => ad 227ae => ae 228af => af 229b0 => b0 230b1 => b1 231b2 => b2 232b3 => b3 233b4 => b4 234b5 => b5 235b6 => b6 236b7 => b7 237b8 => b8 238b9 => b9 239ba => ba 240bb => bb 241bc => bc 242bd => bd 243be => be 244bf => bf 245c0 => c0 246c1 => c1 247c2 => c2 248c3 => c3 249c4 => c4 250c5 => c5 251c6 => c6 252c7 => c7 253c8 => c8 254c9 => c9 255ca => ca 256cb => cb 257cc => cc 258cd => cd 259ce => ce 260cf => cf 261d0 => d0 262d1 => d1 263d2 => d2 264d3 => d3 265d4 => d4 266d5 => d5 267d6 => d6 268d7 => d7 269d8 => d8 270d9 => d9 271da => da 272db => db 273dc => dc 274dd => dd 275de => de 276df => df 277e0 => e0 278e1 => e1 279e2 => e2 280e3 => e3 281e4 => e4 282e5 => e5 283e6 => e6 284e7 => e7 285e8 => e8 286e9 => e9 287ea => ea 288eb => eb 289ec => ec 290ed => ed 291ee => ee 292ef => ef 293f0 => f0 294f1 => f1 295f2 => f2 296f3 => f3 297f4 => f4 298f5 => f5 299f6 => f6 300f7 => f7 301f8 => f8 302f9 => f9 303fa => fa 304fb => fb 305fc => fc 306fd => fd 307fe => fe 308ff => ff 309*** Testing strlower() with basic strings *** 310string(43) "mary had a little lamb and she loved it so 311" 312 313*** Testing strtolower() with various strings *** 314-- Iteration 0 -- 315string(0) "" 316 317-- Iteration 1 -- 318string(6) "string" 319 320-- Iteration 2 -- 321string(10) "string0234" 322 323-- Iteration 3 -- 324string(20) "1.233.344string12333" 325 326-- Iteration 4 -- 327string(31) "$$$$$$!!!!@@@@@@@ abcdef !!!***" 328 329-- Iteration 5 -- 330string(13) "abcd%0abcdabcd" 331 332-- Iteration 6 -- 333string(1) "1" 334 335-- Iteration 7 -- 336string(0) "" 337 338-- Iteration 8 -- 339string(20) "aaaaaaaaaaaaaaaaaaaa" 340 341-- Iteration 9 -- 342string(20) "zzzzzzzzzzzzzzzzzzzz" 343 344-- Iteration 10 -- 345string(20) "@@@@@@@@@@@@@@@@@@@@" 346 347-- Iteration 11 -- 348string(20) "[[[[[[[[[[[[[[[[[[[[" 349 350*** Testing strtolower() with two different case strings *** 351strings are same, with Case Insensitive 352*** Done *** 353