Introduction
This lesson will give a basic introduction to functions and its types, like inbuilt and user-defined functions, as well as their PHP syntax.
We'll cover the following...
What is a Function? #
A function is a block of code that is written in order to perform a specific task.
Let’s discuss a real-life example to understand the concept better. Suppose that a headmaster wants a teacher to calculate the average marks of the students in a class for a particular subject. The teacher will note down all the marks of the students for that subject, perform the required calculations to calculate the average mark and then report the result to the headmaster.
Functions work in a similar way. They take the required information to ...