strtolower-win32.phpt 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. --TEST--
  2. Test strtolower() function
  3. --SKIPIF--
  4. <?php
  5. if (substr(PHP_OS, 0, 3) != "WIN" || !setlocale(LC_CTYPE, "English_United States.1252"))
  6. die('skip Run only on Windows with locale "English_United States.1252" available');
  7. ?>
  8. --FILE--
  9. <?php
  10. setlocale(LC_CTYPE, "English_United States.1252");
  11. echo "*** Testing strtolower() with all 256 chars ***\n";
  12. for ($i=0; $i<=255; $i++){
  13. $char = chr($i);
  14. print(bin2hex($char))." => ".(bin2hex(strtolower("$char")))."\n";
  15. }
  16. echo "*** Testing strlower() with basic strings ***\n";
  17. $str = "Mary Had A liTTle LAmb and ShE loveD IT So\n";
  18. var_dump(strtolower($str));
  19. echo "\n*** Testing strtolower() with various strings ***";
  20. /* strings to pass strtolower() */
  21. $strings = array (
  22. "",
  23. "string",
  24. "stRINg0234",
  25. "1.233.344StrinG12333",
  26. "$$$$$$!!!!@@@@@@@ ABCDEF !!!***",
  27. "ABCD\0abcdABCD",
  28. TRUE,
  29. FALSE,
  30. );
  31. $count = 0;
  32. /* loop through to check possible variations */
  33. foreach ($strings as $string) {
  34. echo "\n-- Iteration $count --\n";
  35. var_dump( strtolower($string) );
  36. $count++;
  37. }
  38. echo "\n*** Testing strtolower() with two different case strings ***\n";
  39. if (strtolower("HeLLo woRLd") === strtolower("hEllo WORLD"))
  40. echo "strings are same, with Case Insensitive\n";
  41. else
  42. echo "strings are not same\n";
  43. echo "*** Done ***";
  44. ?>
  45. --EXPECTF--
  46. *** Testing strtolower() with all 256 chars ***
  47. 00 => 00
  48. 01 => 01
  49. 02 => 02
  50. 03 => 03
  51. 04 => 04
  52. 05 => 05
  53. 06 => 06
  54. 07 => 07
  55. 08 => 08
  56. 09 => 09
  57. 0a => 0a
  58. 0b => 0b
  59. 0c => 0c
  60. 0d => 0d
  61. 0e => 0e
  62. 0f => 0f
  63. 10 => 10
  64. 11 => 11
  65. 12 => 12
  66. 13 => 13
  67. 14 => 14
  68. 15 => 15
  69. 16 => 16
  70. 17 => 17
  71. 18 => 18
  72. 19 => 19
  73. 1a => 1a
  74. 1b => 1b
  75. 1c => 1c
  76. 1d => 1d
  77. 1e => 1e
  78. 1f => 1f
  79. 20 => 20
  80. 21 => 21
  81. 22 => 22
  82. 23 => 23
  83. 24 => 24
  84. 25 => 25
  85. 26 => 26
  86. 27 => 27
  87. 28 => 28
  88. 29 => 29
  89. 2a => 2a
  90. 2b => 2b
  91. 2c => 2c
  92. 2d => 2d
  93. 2e => 2e
  94. 2f => 2f
  95. 30 => 30
  96. 31 => 31
  97. 32 => 32
  98. 33 => 33
  99. 34 => 34
  100. 35 => 35
  101. 36 => 36
  102. 37 => 37
  103. 38 => 38
  104. 39 => 39
  105. 3a => 3a
  106. 3b => 3b
  107. 3c => 3c
  108. 3d => 3d
  109. 3e => 3e
  110. 3f => 3f
  111. 40 => 40
  112. 41 => 61
  113. 42 => 62
  114. 43 => 63
  115. 44 => 64
  116. 45 => 65
  117. 46 => 66
  118. 47 => 67
  119. 48 => 68
  120. 49 => 69
  121. 4a => 6a
  122. 4b => 6b
  123. 4c => 6c
  124. 4d => 6d
  125. 4e => 6e
  126. 4f => 6f
  127. 50 => 70
  128. 51 => 71
  129. 52 => 72
  130. 53 => 73
  131. 54 => 74
  132. 55 => 75
  133. 56 => 76
  134. 57 => 77
  135. 58 => 78
  136. 59 => 79
  137. 5a => 7a
  138. 5b => 5b
  139. 5c => 5c
  140. 5d => 5d
  141. 5e => 5e
  142. 5f => 5f
  143. 60 => 60
  144. 61 => 61
  145. 62 => 62
  146. 63 => 63
  147. 64 => 64
  148. 65 => 65
  149. 66 => 66
  150. 67 => 67
  151. 68 => 68
  152. 69 => 69
  153. 6a => 6a
  154. 6b => 6b
  155. 6c => 6c
  156. 6d => 6d
  157. 6e => 6e
  158. 6f => 6f
  159. 70 => 70
  160. 71 => 71
  161. 72 => 72
  162. 73 => 73
  163. 74 => 74
  164. 75 => 75
  165. 76 => 76
  166. 77 => 77
  167. 78 => 78
  168. 79 => 79
  169. 7a => 7a
  170. 7b => 7b
  171. 7c => 7c
  172. 7d => 7d
  173. 7e => 7e
  174. 7f => 7f
  175. 80 => 80
  176. 81 => 81
  177. 82 => 82
  178. 83 => 83
  179. 84 => 84
  180. 85 => 85
  181. 86 => 86
  182. 87 => 87
  183. 88 => 88
  184. 89 => 89
  185. 8a => 9a
  186. 8b => 8b
  187. 8c => 9c
  188. 8d => 8d
  189. 8e => 9e
  190. 8f => 8f
  191. 90 => 90
  192. 91 => 91
  193. 92 => 92
  194. 93 => 93
  195. 94 => 94
  196. 95 => 95
  197. 96 => 96
  198. 97 => 97
  199. 98 => 98
  200. 99 => 99
  201. 9a => 9a
  202. 9b => 9b
  203. 9c => 9c
  204. 9d => 9d
  205. 9e => 9e
  206. 9f => ff
  207. a0 => a0
  208. a1 => a1
  209. a2 => a2
  210. a3 => a3
  211. a4 => a4
  212. a5 => a5
  213. a6 => a6
  214. a7 => a7
  215. a8 => a8
  216. a9 => a9
  217. aa => aa
  218. ab => ab
  219. ac => ac
  220. ad => ad
  221. ae => ae
  222. af => af
  223. b0 => b0
  224. b1 => b1
  225. b2 => b2
  226. b3 => b3
  227. b4 => b4
  228. b5 => b5
  229. b6 => b6
  230. b7 => b7
  231. b8 => b8
  232. b9 => b9
  233. ba => ba
  234. bb => bb
  235. bc => bc
  236. bd => bd
  237. be => be
  238. bf => bf
  239. c0 => e0
  240. c1 => e1
  241. c2 => e2
  242. c3 => e3
  243. c4 => e4
  244. c5 => e5
  245. c6 => e6
  246. c7 => e7
  247. c8 => e8
  248. c9 => e9
  249. ca => ea
  250. cb => eb
  251. cc => ec
  252. cd => ed
  253. ce => ee
  254. cf => ef
  255. d0 => f0
  256. d1 => f1
  257. d2 => f2
  258. d3 => f3
  259. d4 => f4
  260. d5 => f5
  261. d6 => f6
  262. d7 => d7
  263. d8 => f8
  264. d9 => f9
  265. da => fa
  266. db => fb
  267. dc => fc
  268. dd => fd
  269. de => fe
  270. df => df
  271. e0 => e0
  272. e1 => e1
  273. e2 => e2
  274. e3 => e3
  275. e4 => e4
  276. e5 => e5
  277. e6 => e6
  278. e7 => e7
  279. e8 => e8
  280. e9 => e9
  281. ea => ea
  282. eb => eb
  283. ec => ec
  284. ed => ed
  285. ee => ee
  286. ef => ef
  287. f0 => f0
  288. f1 => f1
  289. f2 => f2
  290. f3 => f3
  291. f4 => f4
  292. f5 => f5
  293. f6 => f6
  294. f7 => f7
  295. f8 => f8
  296. f9 => f9
  297. fa => fa
  298. fb => fb
  299. fc => fc
  300. fd => fd
  301. fe => fe
  302. ff => ff
  303. *** Testing strlower() with basic strings ***
  304. string(43) "mary had a little lamb and she loved it so
  305. "
  306. *** Testing strtolower() with various strings ***
  307. -- Iteration 0 --
  308. string(0) ""
  309. -- Iteration 1 --
  310. string(6) "string"
  311. -- Iteration 2 --
  312. string(10) "string0234"
  313. -- Iteration 3 --
  314. string(20) "1.233.344string12333"
  315. -- Iteration 4 --
  316. string(31) "$$$$$$!!!!@@@@@@@ abcdef !!!***"
  317. -- Iteration 5 --
  318. string(13) "abcd%0abcdabcd"
  319. -- Iteration 6 --
  320. string(1) "1"
  321. -- Iteration 7 --
  322. string(0) ""
  323. *** Testing strtolower() with two different case strings ***
  324. strings are same, with Case Insensitive
  325. *** Done ***