PHP function naming convention

王林
Release: 2023-03-04 10:00:02
Original
3806 people have browsed it

php function naming convention: 1. The name of the function should indicate its function; 2. The function name starts with a letter or underscore; 3. The function name cannot start with a number. Functions are executed by calling functions, and we can call functions anywhere on the page.

PHP function naming convention

Function naming convention:

(Recommended tutorial:php graphic tutorial)

  • The name of the function should hint at its function

  • The function name starts with a letter or underscore (not a number)

Functions are executed by calling functions. We can call functions anywhere on the page.

In order to add more functions to the function, we can add parameters, which are similar to variables. Parameters are specified within a bracket after the function name.

(Video tutorial recommendation:php video tutorial)

Example:

"; } echo "My name is "; writeName("Kai Jim"); echo "My sister's name is "; writeName("Hege"); echo "My brother's name is "; writeName("Stale"); ?>
Copy after login

Output result:

My name is Kai Jim Refsnes. My sister's name is Hege Refsnes. My brother's name is Stale Refsnes.
Copy after login

The above is the detailed content of PHP function naming convention. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!