Home>Article>Backend Development> What is the way to create a function in php

Create a php file named function.

Add the keyword function that defines the function to the file.

Related recommendations: "PHP Tutorial"
Add the name of a custom function after function.

Add a pair of brackets after the custom function name.

Add a pair of curly brackets after the brackets to store a string output by the code block.


Add a statement that calls the custom function and run the file in the browser.

The above is the detailed content of What is the way to create a function in php. For more information, please follow other related articles on the PHP Chinese website!