1--TEST-- 2Test array_flip() function : usage variations - 'input' argument with repeatitive keys and values 3--FILE-- 4<?php 5/* 6* Using different types of repeatitive keys as well as values for 'input' array 7*/ 8 9echo "*** Testing array_flip() : 'input' array with repeatitive keys/values ***\n"; 10 11// array with numeric key repeatition 12$input = array(1 => 'value', 2 => 'VALUE', 1 => "VaLuE", 3 => 4, 3 => 5); 13var_dump( array_flip($input) ); 14 15// array with string key repeatition 16$input = array("key" => 1, "two" => 'TWO', 'three' => 3, 'key' => "FOUR"); 17var_dump( array_flip($input) ); 18 19// array with bool key repeatition 20$input = array(true => 1, false => 0, TRUE => -1); 21var_dump( array_flip($input) ); 22 23// array with null key repeatition 24$input = array(null => "Hello", NULL => 0); 25var_dump( array_flip($input) ); 26 27// array with numeric value repeatition 28$input = array('one' => 1, 'two' => 2, 3 => 1, "index" => 1); 29var_dump( array_flip($input) ); 30 31//array with string value repeatition 32$input = array('key1' => "value1", "key2" => '2', 'key3' => 'value1'); 33var_dump( array_flip($input) ); 34 35echo "Done" 36?> 37--EXPECT-- 38*** Testing array_flip() : 'input' array with repeatitive keys/values *** 39array(3) { 40 ["VaLuE"]=> 41 int(1) 42 ["VALUE"]=> 43 int(2) 44 [5]=> 45 int(3) 46} 47array(3) { 48 ["FOUR"]=> 49 string(3) "key" 50 ["TWO"]=> 51 string(3) "two" 52 [3]=> 53 string(5) "three" 54} 55array(2) { 56 [-1]=> 57 int(1) 58 [0]=> 59 int(0) 60} 61array(1) { 62 [0]=> 63 string(0) "" 64} 65array(2) { 66 [1]=> 67 string(5) "index" 68 [2]=> 69 string(3) "two" 70} 71array(2) { 72 ["value1"]=> 73 string(4) "key3" 74 [2]=> 75 string(4) "key2" 76} 77Done 78