1--TEST-- 2Test array_flip() function : usage variations - 'input' argument with different invalid values for keys 3--FILE-- 4<?php 5/* Prototype : array array_flip(array $input) 6 * Description: Return array with key <-> value flipped 7 * Source code: ext/standard/array.c 8*/ 9 10/* 11* Trying different invalid values for 'input' array argument 12*/ 13 14echo "*** Testing array_flip() : different invalid values in 'input' array argument ***\n"; 15 16// class definition for object data 17class MyClass 18{ 19 public function __toString() 20 { 21 return 'object'; 22 } 23} 24$obj = new MyClass(); 25 26// resource data 27$fp = fopen(__FILE__, 'r'); 28 29$input = array( 30 // float values 31 'float_value1' => 1.2, 32 'float_value2' => 0.5, 33 'flaot_value3' => 3.4E3, 34 'flaot_value4' => 5.6E-6, 35 36 // bool values 37 'bool_value1' => true, 38 'bool_value2' => false, 39 'bool_value3' => TRUE, 40 'bool_value4' => FALSE, 41 42 // null values 43 'null_value1' => null, 44 45 // array value 46 'array_value' => array(1), 47 48 // object value 49 'obj_value' => $obj, 50 51 // resource value 52 'resource_value' => $fp, 53); 54 55var_dump( array_flip($input) ); 56 57// closing resource 58fclose($fp); 59 60echo "Done" 61?> 62--EXPECTF-- 63*** Testing array_flip() : different invalid values in 'input' array argument *** 64 65Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d 66 67Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d 68 69Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d 70 71Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d 72 73Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d 74 75Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d 76 77Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d 78 79Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d 80 81Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d 82 83Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d 84 85Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d 86 87Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d 88array(0) { 89} 90Done 91