Basic functions of PHP development tutorial
1. Overview of PHP functions
The real power of PHP comes from its functions.
In PHP, more than 1000 built-in functions are provided.
Function is function. Calling a function is calling a function.
2. PHP built-in functions
The date() and rand() functions we used earlier are all built-in functions of the system. Details When you use it in the future, please check the PHP manual. There are detailed examples above. In the advanced tutorials that follow, there will also be an introduction to commonly used functions. In this chapter, our focus is on how to create our own functions.
3. PHP custom function
1. Create a function
Syntax:
function functionName()
{
Code to be executed;
}
PHP function guidelines:
The name of the function should hint at its function
The function name starts with a letter or underscore (not a number)
Note : There is no semicolon after the curly braces
2. Call the function
Syntax:
functionName;
Write Function names can be separated by semicolons
A simple example: the code is as follows
##4. Add parameters to the custom function
5. The return value of the function