2 Test strtolower() function
5 if( substr(PHP_OS, 0, 3) == 'WIN') {
6 if (!setlocale(LC_ALL, 'C')) {
7 die('skip need "C" locale (this windows is broken)');
10 if (!setlocale(LC_ALL, 'en_US.UTF-8', 'en')) {
11 die('skip need "en_US.UTF-8" locale');
18 string strtolower ( string $str );
20 Returns string with all alphabetic characters converted to lowercase.
22 if( substr(PHP_OS, 0, 3) == 'WIN') {
23 setlocale(LC_ALL, 'C');
25 setlocale(LC_ALL, 'en_US.UTF-8');
28 echo "*** Testing strtolower() with 128 chars ***\n";
29 for ($i=0; $i<=127; $i++){
31 print(bin2hex($char))." => ".(bin2hex(strtolower("$char")))."\n";
34 echo "*** Testing strlower() with basic strings ***\n";
35 $str = "Mary Had A liTTle LAmb and ShE loveD IT So\n";
36 var_dump(strtolower($str));
38 echo "\n*** Testing strtolower() with various strings ***";
39 /* strings to pass strtolower() */
44 "1.233.344StrinG12333",
45 "$$$$$$!!!!@@@@@@@ ABCDEF !!!***",
53 /* loop through to check possible variations */
54 foreach ($strings as $string) {
55 echo "\n-- Iteration $count --\n";
56 var_dump( strtolower($string) );
60 echo "\n*** Testing strtolower() with two different case strings ***\n";
61 if (strtolower("HeLLo woRLd") === strtolower("hEllo WORLD"))
62 echo "strings are same, with Case Insensitive\n";
64 echo "strings are not same\n";
69 *** Testing strtolower() with 128 chars ***
198 *** Testing strlower() with basic strings ***
199 string(43) "mary had a little lamb and she loved it so
202 *** Testing strtolower() with various strings ***
210 string(10) "string0234"
213 string(20) "1.233.344string12333"
216 string(31) "$$$$$$!!!!@@@@@@@ abcdef !!!***"
219 string(13) "abcd
\0abcdabcd"
230 *** Testing strtolower() with two different case strings ***
231 strings are same, with Case Insensitive