A “function” in programming terminology, is a group of statements that execute a particular task. There are various types of PHP functions that we’re going to cover in this tutorial.
But first, Let’s take an example to understand functions.
The abs( mixed $number ) is an inbuilt PHP function which returns the absolute value of a number. The “abs” is followed by an opening and closing braces.
In between, we have a parameter that we’re sending to the function; in this case, it’s -10.2.
If I echo $num, I should get the result of 10.2.
<?php $num = abs(-10.2); echo $num; // 10.2 ?>
So, what happened?
Continue reading “Functions in PHP – A Simplified Guide”