import zend standard tests
[hiphop-php.git] / hphp / test / zend / good / ext-standard-array / shuffle_variation3.php
blob0804fb46f4cef315b23ac86c581429d1b2107fc8
1 <?php
2 /* Prototype : bool shuffle(array $array_arg)
3 * Description: Randomly shuffle the contents of an array
4 * Source code: ext/standard/array.c
5 */
7 /*
8 * Test behaviour of shuffle() function when arrays having different
9 * types of values, are passed to 'array_arg' argument
12 echo "*** Testing shuffle() : arrays with diff types of values ***\n";
14 // initialise different arrays
15 $array_arg = array(
16 // array with positive int values
17 /*1*/ array(0, 1, 2, 2147483647 ),
19 // array with negative int values
20 array(-1, -2, -2147483647 ),
22 // array with positive float values
23 /*3*/ array(0.23, 1.34, 0e2, 200e-2, 30e2, 10e0, 2147473648.90),
25 // array with negative float values
26 array(-0.23, -1.34, -200e-2, -30e2, -10e0, -2147473649.80),
28 // array with single quoted and double quoted strings
29 /*5*/ array('one', "123numbers", 'hello\tworld', "hello world\0", '12.34floatnum'),
31 // array with bool values
32 array(true, TRUE, FALSE, false),
34 // array with positive hexa values
35 /*7*/ array(0x123, 0xabc, 0xABC, 0xac, 0xAb1, 0x9fa),
37 // array with negative hexa values
38 array(-0x123, -0xabc, -0xABC, -0xAb1, -0x9fa),
40 // array with positive octal values
41 /*9*/ array(0123, 02348, 034, 00),
43 // array with negative octal values
44 /*10*/ array(-0123, -02348, -034),
48 // looping to test shuffle() with each sub-array in the $array_arg array
49 echo "\n*** Testing shuffle() with arrays having different types of values ***\n";
50 $counter = 1;
51 foreach($array_arg as $arr) {
52 echo "\n-- Iteration $counter --\n";
53 var_dump( shuffle($arr) );
54 echo "\nThe output array is:\n";
55 var_dump( $arr );
56 $counter++;
59 echo "Done";