Showing posts from April, 2020

PHP 7.4 Functions - Exercise

You must be using PHP 7.4, as some of features mentioned below may not be available in PHP earlier versions. Create multiple short programs using PHP that shall perform the functionality described below. You shall be able to do most of stuff if you have attended PHP Functions lecture but some functionality may require you to read more on web to complete, to help you in self learning. Program #1. Write a PHP function that shall take an integer parameter representing year. Your function shall return a boolean representing whether the year is a leap year or not. Mention the type on prototype but do not use strict_type mode. If user passes, a non integer data, you functions hall return null. Program #2. There is a special type of function in PHP, call variadic functions or variable length arguments. Make a function that user shall call passing none, single or any number of numeric paramters. The function shall return sum of all numbers. If nothing is passed as argument, the