1--TEST-- 2Test array_fill_keys() function : variation of parameter 3--FILE-- 4<?php 5/* Prototype : proto array array_fill_keys(array keys, mixed val) 6 * Description: Create an array using the elements of the first parameter as keys each initialized to val 7 * Source code: ext/standard/array.c 8 * Alias to functions: 9 */ 10 11/* Testing with unexpected argument types */ 12 13echo "*** Testing array_fill_keys() : parameter variations ***\n"; 14 15$simpleStr = "simple"; 16$fp = fopen(__FILE__, "r"); 17$bool = false; 18$float = 2.4; 19$array = array("one", "two"); 20$nullVal = null; 21 22echo "\n-- Testing array_fill_keys() function with both wrong arguments --\n"; 23var_dump( array_fill_keys($bool, $float) ); 24 25echo "\n-- Testing array_fill_keys() function with unusual second arguments --\n"; 26var_dump( array_fill_keys($array, $fp) ); 27 28echo "\n-- Testing array_fill_keys() function with mixed array --\n"; 29var_dump( array_fill_keys($nullVal, $simpleStr) ); 30 31fclose($fp); 32echo "Done"; 33?> 34--EXPECTF-- 35*** Testing array_fill_keys() : parameter variations *** 36 37-- Testing array_fill_keys() function with both wrong arguments -- 38 39Warning: array_fill_keys() expects parameter 1 to be array, bool given in %sarray_fill_keys_variation3.php on line %d 40NULL 41 42-- Testing array_fill_keys() function with unusual second arguments -- 43array(2) { 44 ["one"]=> 45 resource(%d) of type (stream) 46 ["two"]=> 47 resource(%d) of type (stream) 48} 49 50-- Testing array_fill_keys() function with mixed array -- 51 52Warning: array_fill_keys() expects parameter 1 to be array, null given in %sarray_fill_keys_variation3.php on line %d 53NULL 54Done 55