Functions in PHP
PHP functions are similar to other programming languages. A function is a piece of code which takes one more input in the form of parameter and does some processing and returns a value.
You already have seen many functions like `echo()` and `print_r()` etc. They are built-in functions but PHP gives you option to create your own functions as well.
Its very easy to create your own PHP function. Suppose you want to create a PHP function which will simply write a simple message on your browser when you will call it.
Following example creates a function called `sayHello()` and then calls it just after creating it.
You already have seen many functions like `echo()` and `print_r()` etc. They are built-in functions but PHP gives you option to create your own functions as well.
Its very easy to create your own PHP function. Suppose you want to create a PHP function which will simply write a simple message on your browser when you will call it.
Following example creates a function called `sayHello()` and then calls it just after creating it.
June 11, 2021
phpfunctions