1--TEST-- 2Test crc32() function : usage variations - heredoc 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 heredoc strings passed to the str argument 12*/ 13 14echo "*** Testing crc32() : with different heredoc strings ***\n"; 15 16// defining different heredoc strings 17$empty_heredoc = <<<EOT 18EOT; 19 20$heredoc_with_newline = <<<EOT 21\n 22 23EOT; 24 25$heredoc_with_characters = <<<EOT 26first line of heredoc string 27second line of heredoc string 28third line of heredocstring 29EOT; 30 31$heredoc_with_newline_and_tabs = <<<EOT 32hello\tworld\nhello\nworld\n 33EOT; 34 35$heredoc_with_alphanumerics = <<<EOT 36hello123world456 371234hello\t1234 38EOT; 39 40$heredoc_with_embedded_nulls = <<<EOT 41hello\0world\0hello 42\0hello\0 43EOT; 44 45$heredoc_with_hexa_octal = <<<EOT 46hello\0\100\xaaworld\0hello 47\0hello\0 48EOT; 49 50$heredoc_with_long_string = <<<EOT 51aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbb 52cccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddd 53eeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffff 54gggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhh 55111111111111111111111122222222222222222222222222222222222222222222 56333333333333333333333333333333333334444444444444444444444444444444 57555555555555555555555555555555555555555555556666666666666666666666 58777777777777777777777777777777777777777777777777777777777777777777 59/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 60/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/n 61EOT; 62 63$heredoc_strings = array( 64 $empty_heredoc, 65 $heredoc_with_newline, 66 $heredoc_with_characters, 67 $heredoc_with_newline_and_tabs, 68 $heredoc_with_alphanumerics, 69 $heredoc_with_embedded_nulls, 70 $heredoc_with_hexa_octal, 71 $heredoc_with_long_string 72 ); 73 74// loop to test the function with each heredoc string in the array 75 76$count = 1; 77foreach($heredoc_strings as $str) { 78 echo "\n-- Iteration $count --\n"; 79 var_dump( crc32($str) ); 80 $count++; 81} 82 83echo "Done"; 84?> 85--EXPECT-- 86*** Testing crc32() : with different heredoc strings *** 87 88-- Iteration 1 -- 89int(0) 90 91-- Iteration 2 -- 92int(1541608299) 93 94-- Iteration 3 -- 95int(1588851550) 96 97-- Iteration 4 -- 98int(-1726108239) 99 100-- Iteration 5 -- 101int(-1847303891) 102 103-- Iteration 6 -- 104int(-1260053120) 105 106-- Iteration 7 -- 107int(-1718044186) 108 109-- Iteration 8 -- 110int(1646793751) 111Done 112