You may have seen functions or you may not.  Function() is a defined chunck of code set which can be executed when ever it is needed. A function() consists of a few simple steps.

  • All functions start with the word “function” followed by a related name for the function with “()” after it.
  • Insert { in the second line, after this bracket is where you set what the function will do.
  • Insert } at the end of the function to close it off.

For this example i will be creating a function that will echo the message i have set.

<?php

function Name()
{
echo ‘John’;
}

?>

Thats all and that will display the name John on the page, the function i have made is not very useful but allows you to learn the basic understanding the use function().

If you have any questions please comment below and i will reply as soon as possible.

Leave a Reply

You must be logged in to post a comment.