1--TEST-- 2Test array_flip() function : basic functionality 3--FILE-- 4<?php 5echo "*** Testing array_flip() : basic functionality ***\n"; 6 7// array with default keys - numeric values 8$input = array(1, 2); 9var_dump( array_flip($input) ); 10 11// array with default keys - string values 12$input = array('value1', "value2"); 13var_dump( array_flip($input) ); 14 15// associative arrays - key as string 16$input = array('key1' => 1, "key2" => 2); 17var_dump( array_flip($input) ); 18 19// associative arrays - key as numeric 20$input = array(1 => 'one', 2 => "two"); 21var_dump( array_flip($input) ); 22 23// combination of associative and non-associative array 24$input = array(1 => 'one','two', 3 => 'three', 4, "five" => 5); 25var_dump( array_flip($input) ); 26echo "Done" 27?> 28--EXPECT-- 29*** Testing array_flip() : basic functionality *** 30array(2) { 31 [1]=> 32 int(0) 33 [2]=> 34 int(1) 35} 36array(2) { 37 ["value1"]=> 38 int(0) 39 ["value2"]=> 40 int(1) 41} 42array(2) { 43 [1]=> 44 string(4) "key1" 45 [2]=> 46 string(4) "key2" 47} 48array(2) { 49 ["one"]=> 50 int(1) 51 ["two"]=> 52 int(2) 53} 54array(5) { 55 ["one"]=> 56 int(1) 57 ["two"]=> 58 int(2) 59 ["three"]=> 60 int(3) 61 [4]=> 62 int(4) 63 [5]=> 64 string(4) "five" 65} 66Done 67