1--TEST-- 2Test array_fill_keys() function : variation of parameter 3--FILE-- 4<?php 5echo "*** Testing array_fill_keys() : parameter variations ***\n"; 6 7$nullVal = null; 8$simpleStr = "simple"; 9$fp = fopen(__FILE__, "r"); 10$emptyArr = array(); 11$bool = false; 12$float = 2.4; 13 14class classA { 15 public function __toString() { return "Class A object"; } 16} 17$obj = new classA(); 18 19 20echo "\n-- Testing array_fill_keys() function with empty arguments --\n"; 21var_dump( array_fill_keys($emptyArr, $nullVal) ); 22 23echo "\n-- Testing array_fill_keys() function with keyed array --\n"; 24$keyedArray = array("two" => 2, "strk1" => "strv1", 4, $simpleStr); 25var_dump( array_fill_keys($keyedArray, $simpleStr) ); 26 27echo "\n-- Testing array_fill_keys() function with mixed array --\n"; 28$mixedArray = array($fp, $obj, $simpleStr, $emptyArr, 2, $bool, $float); 29var_dump( array_fill_keys($mixedArray, $simpleStr) ); 30 31fclose($fp); 32echo "Done"; 33?> 34--EXPECTF-- 35*** Testing array_fill_keys() : parameter variations *** 36 37-- Testing array_fill_keys() function with empty arguments -- 38array(0) { 39} 40 41-- Testing array_fill_keys() function with keyed array -- 42array(4) { 43 [2]=> 44 string(6) "simple" 45 ["strv1"]=> 46 string(6) "simple" 47 [4]=> 48 string(6) "simple" 49 ["simple"]=> 50 string(6) "simple" 51} 52 53-- Testing array_fill_keys() function with mixed array -- 54 55Warning: Array to string conversion in %s on line %d 56array(7) { 57 ["Resource id #%d"]=> 58 string(6) "simple" 59 ["Class A object"]=> 60 string(6) "simple" 61 ["simple"]=> 62 string(6) "simple" 63 ["Array"]=> 64 string(6) "simple" 65 [2]=> 66 string(6) "simple" 67 [""]=> 68 string(6) "simple" 69 ["2.4"]=> 70 string(6) "simple" 71} 72Done 73