How to use simple function in PHP
In this article, I will explain how the simple function can be used in PHP.
Simple
Function in PHP
- A function declaration starts with the
special word 'function'.
- A function name starts with a letter or
underscore, followed by any number of letters, numbers, or underscores.
- A function names are case-insensitive.
- A function is block of code that can be
executed whenever we need it.
Syntax
function functionname()
{
code to be executed;
} |
Example
The following example show the simple function
that writes any name when it is called:
<html>
<body>
<h2 style="color: steelblue;">Simple Function Loop
example</h2>
<?php
function writeName()
{
echo "C-Sharpcorner";
}
echo "Welcome To...";
writeName();
?>
</body>
</html> |
Output

You may also want to read these related articles
here
Ask Your
Question
Got a programming related question? You
may want to post your question here