Course Content
State Management
0/1
Regular Expressions?
0/1
About Lesson

What is Functions?

A function is a block of code written in the program to perform some specific task. We can relate functions in programs to employees in office in real life for understanding of how functions work.

Types of FUNCTIONS:

PHP provides us with two types of functions:

  • Built-in functions: PHP provides us with huge collection of built-in library functions. These functions are already coded and stored in form of functions. To use those we just need to call them as per our requirement like, var_dump(), print_r(), fopen(),gettype() and so on.
  • User Defined Functions: Apart from the built-in functions, PHP allows us to create our own customised functions called the user defined functions.

Syntax:

PHP
<?php

  function function_name( ){

          Statement;

}

?>