PHP functions ?


A function is a block of code that performs a specific task, with the help of function we can dividing complex or large program into small components makes program easy to understand and we can find error. A large program can be divided into different part called modules, where each module does a specific task so each module is called a function.


Types of functions

  1. Library functions or pre-defined functions
  2. User-defined functions

Library functions or pre-defined functions

PHP library that comes with PHP parser has a collection of various functions which perform standard and per-defined tasks are called library functions.


User-defined functions

The functions written by the programmer or user to do the specific tasks are called user defined function or programmer defined function.



Types of user-defined functions
  1. Default functions
  2. call by value
  3. call by reference