In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to use PHP custom function, the article is very detailed, has a certain reference value, interested friends must read it!
PHP custom function
PHP has provided us with many powerful system functions, but this is far from meeting the needs. Programmers can create a custom function according to the needs of the development. Functions are executed by calling functions. An example of the basic syntax format of a custom function is as follows:
Function function name (parameter 1, parameter 2,..., parameter n) {function body in the function; return return value;}
The above grammatical format has the following characteristics:
The first line of each function consists of three parts: the keyword function, the function name, and the argument list.
Each custom function must start with function, that is, declare using function
A function can have a return return value or no return value
A function cannot be defined twice, that is, a function cannot be overloaded
The parenthesis "()" after the function name is also necessary when declaring the function. There is a list of parameters in the parentheses, and the parameters are the declared variables, which can then be passed to the function when the function is called. The parameter list can be empty or have one or more parameters separated by commas
After the function is created, like the system function, you can call the function anywhere on the page.
Output result:
Function names are the same as variable naming rules, except that function names are not case-sensitive.
Output result:
Functions can be called before or after definition. That is, the function can be called anywhere.
Output result:
If there is a return in the function action execution module, the code after the return will not be executed.
Output result:
After the execution of the function, return can take the value in the body of the function out of the function.
Output result:
The variables of the function body have nothing to do with the variables outside the function.
Function cannot be overloaded
The output will report an error and the function cannot be overloaded.
These are all the contents of this article entitled "how to use PHP Custom functions". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.