1--TEST-- 2Test array_key_first() function (errors) 3--FILE-- 4<?php 5 6$empty_array = array(); 7$number = 5; 8$str = "abc"; 9 10/* Various combinations of arrays to be used for the test */ 11$mixed_array = array( 12 array( 1,2,3,4,5,6,7,8,9 ), 13 array( "One", "_Two", "Three", "Four", "Five" ) 14); 15 16/* Testing Error Conditions */ 17echo "\n*** Testing Error Conditions ***\n"; 18 19/* Zero argument */ 20var_dump( array_key_first() ); 21 22/* Scalar argument */ 23var_dump( array_key_first($number) ); 24 25/* String argument */ 26var_dump( array_key_first($str) ); 27 28/* Invalid Number of arguments */ 29var_dump( array_key_first($mixed_array[0],$mixed_array[1]) ); 30 31/* Empty Array as argument */ 32var_dump( array_key_first($empty_array) ); 33 34echo"\nDone"; 35?> 36--EXPECTF-- 37*** Testing Error Conditions *** 38 39Warning: array_key_first() expects exactly 1 parameter, 0 given in %s on line %d 40NULL 41 42Warning: array_key_first() expects parameter 1 to be array, int given in %s on line %d 43NULL 44 45Warning: array_key_first() expects parameter 1 to be array, string given in %s on line %d 46NULL 47 48Warning: array_key_first() expects exactly 1 parameter, 2 given in %s on line %d 49NULL 50NULL 51 52Done 53