1--TEST-- 2Test crc32() function : usage variations - double quoted strings 3--SKIPIF-- 4<?php 5if (PHP_INT_SIZE != 4) 6 die("skip this test is for 32bit platform only"); 7?> 8--FILE-- 9<?php 10/* 11 * Testing crc32() : with different strings in double quotes passed to the function 12*/ 13 14echo "*** Testing crc32() : with different strings in double quotes ***\n"; 15 16// defining an array of strings 17$string_array = array( 18 "", 19 " ", 20 "hello world", 21 "HELLO WORLD", 22 " helloworld ", 23 24 "(hello world)", 25 "hello(world)", 26 "helloworld()", 27 "hello()(world", 28 29 "'hello' world", 30 "hello 'world'", 31 "hello''world", 32 33 "hello\tworld", 34 "hellowor\\tld", 35 "\thello world\t", 36 "helloworld", 37 "hellowor\\ld", 38 "hello\nworld", 39 "hellowor\\nld", 40 "\nhello world\n", 41 "\n\thelloworld", 42 "hel\tlo\n world", 43 44 "!@#$%&", 45 "#hello@world.com", 46 "$hello$world", 47 48 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbb 49 cccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddd 50 eeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffff 51 gggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhh 52 111111111111111111111122222222222222222222222222222222222222222222 53 333333333333333333333333333333333334444444444444444444444444444444 54 555555555555555555555555555555555555555555556666666666666666666666 55 777777777777777777777777777777777777777777777777777777777777777777 56 /t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t 57 /n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n" 58); 59 60// looping to check the behaviour of the function for each string in the array 61 62$count = 1; 63foreach($string_array as $str) { 64 echo "\n-- Iteration $count --\n"; 65 var_dump( crc32($str) ); 66 $count++; 67} 68 69echo "Done"; 70?> 71--EXPECTF-- 72*** Testing crc32() : with different strings in double quotes *** 73 74Warning: Undefined variable $hello in %s on line %d 75 76Warning: Undefined variable $world in %s on line %d 77 78-- Iteration 1 -- 79int(0) 80 81-- Iteration 2 -- 82int(-378745019) 83 84-- Iteration 3 -- 85int(222957957) 86 87-- Iteration 4 -- 88int(-2015000997) 89 90-- Iteration 5 -- 91int(1234261835) 92 93-- Iteration 6 -- 94int(-1867296214) 95 96-- Iteration 7 -- 97int(1048577080) 98 99-- Iteration 8 -- 100int(2129739710) 101 102-- Iteration 9 -- 103int(-1633247628) 104 105-- Iteration 10 -- 106int(1191242624) 107 108-- Iteration 11 -- 109int(603128807) 110 111-- Iteration 12 -- 112int(-525789576) 113 114-- Iteration 13 -- 115int(770262395) 116 117-- Iteration 14 -- 118int(243585859) 119 120-- Iteration 15 -- 121int(-986324846) 122 123-- Iteration 16 -- 124int(-102031187) 125 126-- Iteration 17 -- 127int(-588181215) 128 129-- Iteration 18 -- 130int(-1417857067) 131 132-- Iteration 19 -- 133int(523630053) 134 135-- Iteration 20 -- 136int(-503915034) 137 138-- Iteration 21 -- 139int(-254912432) 140 141-- Iteration 22 -- 142int(-1581578467) 143 144-- Iteration 23 -- 145int(-1828940657) 146 147-- Iteration 24 -- 148int(-1654468652) 149 150-- Iteration 25 -- 151int(0) 152 153-- Iteration 26 -- 154int(1431761713) 155Done 156