Skip to main content

PHP Functions

Body
Functions play an important role in any programming languages. It allows you to organize your code in smaller part. A function can be called repeatedly in your program and can return or not return any value. There are more than 1,000 built-in functions in PHP and you can also create your own function. Here’s the syntax of a user defined function:

function functionName()
{
    your code or statement here;
}
When you name a function, make sure that it reflects the code that you write so you will know its purpose. Let’s create a sample that will print the Hello World

Add new comment