How To Create A Function In PHP?

A1WEBSITEPRO QuestionsCategory: PHPHow To Create A Function In PHP?
Rich asked 5 years ago

How can I create a function in PHP? Is it like a variable?

How To Create A Function In PHP? was last modified: November 9th, 2018 by Rich
1 Answers
Maximus Mccullough Staff answered 5 years ago

You can create a php function like this.

<?php function foo(){
echo 'This is a function';
};?>

Then you would call it into your application like this.

<?php foo(); ?>

We cover it more in our PHP7 Functions Tutorial here.

Only cool people share!

Answer for How To Create A Function In PHP? was last modified: March 19th, 2023 by Maximus Mccullough