Follow:  Follow PHPExercises on Twitter  Follow us on Facebook

PHP Functions Ex. #6: Function That Calls Another

For this PHP exercise, pull up your script from Functions Ex. #4. The days of the month array is fine as it is. Rewrite the "option" function as "makeOptions", such that it includes all the work of creating the option. It will need to take an array as an argument and iterate over the array key values to produce the options.

Write a second function, "makeSelect", to create the entire select field. This function should call the "makeOptions" function to produce the options. Give the function an error checking action to assure that the variable used for options is actually an array.