How to use simple function in PHP

In this article, I will explain how the simple function can be used in PHP.
  • 1946

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.


function functionname()
  code to be executed;


The following example show the simple function that writes any name when it is called:



<h2 style="color: steelblue;">Simple Function Loop example</h2>


    function writeName()


    echo "C-Sharpcorner";


    echo "Welcome To...";








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
© 2020 DotNetHeaven. All rights reserved.