1--TEST-- 2Test array_column() function: error conditions 3--FILE-- 4<?php 5/* Prototype: 6 * array array_column(array $input, mixed $column_key[, mixed $index_key]); 7 * Description: 8 * Returns an array containing all the values from 9 * the specified "column" in a two-dimensional array. 10 */ 11 12echo "*** Testing array_column() : error conditions ***\n"; 13 14echo "\n-- Testing array_column() function with Zero arguments --\n"; 15var_dump(array_column()); 16 17echo "\n-- Testing array_column() function with One argument --\n"; 18var_dump(array_column(array())); 19 20echo "\n-- Testing array_column() function with string as first parameter --\n"; 21var_dump(array_column('foo', 0)); 22 23echo "\n-- Testing array_column() function with int as first parameter --\n"; 24var_dump(array_column(1, 'foo')); 25 26echo "\n-- Testing array_column() column key parameter should be a string or an integer (testing bool) --\n"; 27var_dump(array_column(array(), true)); 28 29echo "\n-- Testing array_column() column key parameter should be a string or integer (testing array) --\n"; 30var_dump(array_column(array(), array())); 31 32echo "\n-- Testing array_column() index key parameter should be a string or an integer (testing bool) --\n"; 33var_dump(array_column(array(), 'foo', true)); 34 35echo "\n-- Testing array_column() index key parameter should be a string or integer (testing array) --\n"; 36var_dump(array_column(array(), 'foo', array())); 37 38echo "Done\n"; 39?> 40--EXPECTF-- 41*** Testing array_column() : error conditions *** 42 43-- Testing array_column() function with Zero arguments -- 44 45Warning: array_column() expects at least 2 parameters, 0 given in %s on line %d 46NULL 47 48-- Testing array_column() function with One argument -- 49 50Warning: array_column() expects at least 2 parameters, 1 given in %s on line %d 51NULL 52 53-- Testing array_column() function with string as first parameter -- 54 55Warning: array_column() expects parameter 1 to be array, string given in %s on line %d 56NULL 57 58-- Testing array_column() function with int as first parameter -- 59 60Warning: array_column() expects parameter 1 to be array, integer given in %s on line %d 61NULL 62 63-- Testing array_column() column key parameter should be a string or an integer (testing bool) -- 64 65Warning: array_column(): The column key should be either a string or an integer in %s on line %d 66bool(false) 67 68-- Testing array_column() column key parameter should be a string or integer (testing array) -- 69 70Warning: array_column(): The column key should be either a string or an integer in %s on line %d 71bool(false) 72 73-- Testing array_column() index key parameter should be a string or an integer (testing bool) -- 74 75Warning: array_column(): The index key should be either a string or an integer in %s on line %d 76bool(false) 77 78-- Testing array_column() index key parameter should be a string or integer (testing array) -- 79 80Warning: array_column(): The index key should be either a string or an integer in %s on line %d 81bool(false) 82Done 83