Home >Backend Development >PHP Problem >How to create a function in php
How to create a function in php?
Create a php file named function.
Add the keyword function to define the function in the file
Add a custom function after function Name
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.
Note
Do not add a semicolon after brackets and curly braces
The above is the detailed content of How to create a function in php. For more information, please follow other related articles on the PHP Chinese website!