Home > Backend Development > PHP Problem > What does php class mean?

What does php class mean?

藏色散人
Release: 2023-03-01 18:36:01
Original
3427 people have browsed it

php class is a collection of variables and functions that act on these variables. A php class defines the abstract characteristics of a thing, and includes the form of data and operations on data. The syntax for creating a class is "class Class name {#implementation of class#member quantity#encapsulated function#member method}".

What does php class mean?

php class

A class is a collection of variables and functions that act on these variables.

Class − Defines the abstract characteristics of a thing. The definition of a class includes the form of the data and the operations on the data.

Create a class

class 类名{
    #类的实现
    #成员量
    #封装函数
    #成员方法
}
Copy after login

Class naming convention

1) Class names can only use letters, starting with an underscore, not Start with a number

2) Class names cannot use keywords

3) Class names must be meaningful

4) Class names are not case-sensitive, but it is best to use camel case How to write the method

userModel UserModel

5) Class names cannot be repeated

6)Class Connect{} Empty class, does the empty function make sense? The empty class is for the later stage of the project Extension reserved interface

For detailed knowledge about classes, please visit the "PHP Object Oriented" chapter

The above is the detailed content of What does php class mean?. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template