Introduction
In this article I will explain User Defined Functions in PHP. A function is a block of statements used repeatedly in a program. A PHP function works as in other languages like "C". PHP provides one thousand built-in functions. These functions are defined as per our requirements, these functions are called User Defined Functions. A function is defined using the special keyword "function" and the function. A valid function name starts with a letter or underscore and function names are case-insensitive.
Syntax
|
function function name() { Statements: } |
Example
<?php
function f_name()
{
echo "Good Bye..";
}
f_name();
?>
When we call the above function it will print "good bye".
Conditional Function
<?php
$name = true;
shyam();
if ($name) {
function ram()
{



Join the conversation! Your thoughts help the community grow.