Monday, 18 September 2017

PHP Functions

Function
  • A function is a named block of code that performs a specific task.
  • Functions are compiled only once for the page.
  • They improve readability by isolating code that performs specific tasks.

Now, analyse all the concepts of Function in PHP with a suitable example. Consider the follow output:-


The code of the above page is as follows:-



When  I will click on "Default Argument", the output will be as follows:


The code of the above page is as follows:-


When  I will click on "Passing Two Arguments", the output will be as follows:


The code of the above page is as follows:-



When  I will click on "Function Argument", the output will be as follows:

The code of the above page is as follows:-


When  I will click on "Variable Scope", the output will be as follows:

The code of the above page is as follows:-


When  I will click on "Global Scope", the output will be as follows:

The code of the above page is as follows:-


When  I will click on "Call By Value", the output will be as follows:

The code of the above page is as follows:-


When  I will click on "Call By Reference", the output will be as follows:

The code of the above page is as follows:-


When  I will click on "Static Variable", the output will be as follows:

The code of the above page is as follows:-


When  I will click on "Variable Functions", the output will be as follows:

The code of the above page is as follows:-


No comments:

Post a Comment