Functions in PHP – A Simplified Guide

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”

PHP Class in depth analysis (Part 1)

Before jumping to the PHP Class, let’s observe our surroundings for a moment. You see tangible things in your room like books, table, chair, clothes etc. Each of these items may or may not be useful to you.

Let say you have a book. But you don’t have just one book, maybe you have few or many. But books nevertheless. If you ask school going kid what he has in his bag, he will most probably answer “books”.

In our world, there are millions and millions of books. Some are thick, some are thin. Some are big and heavy, some are light and pocket sized. But they are still books. Hope you agree to this point.

Continue reading “PHP Class in depth analysis (Part 1)”